vpllan / jQuery.dataTables.oData

jQuery dataTables OData connector
http://vpllan.github.io/jQuery.dataTables.oData/
31 stars 20 forks source link

OData Query picking up column not supposed to be used in query #7

Closed alexvance89 closed 10 years ago

alexvance89 commented 10 years ago

I have a datatable that i've set up to contain a "Actions" column to contain an edit/resend/delete icons/links. It is including that column as part of the query and it causes the odata query request to fail.

The query string/url is:

http://localhost:64344/odata/exceptionmessages?%24select=ExceptionMessageId%2CQueue%2CExchange%2CMessageType%2CActions&%24skip=0&%24top=10&%24inlinecount=allpages&%24orderby=ExceptionMessageId+asc&_=1398354802800

As you can see the query string contains "%2CActions" and it shouldn't. How can I exclude this from the query itself?

It returns back the following error:

Could not find a property named 'Actions' on type 'ExceptionMessageEntity'. /m:message This happens after I add the "Actions" to my table in the html. Here is the code i used to setup datatables with... $("#exceptions").dataTable({ "sPaginationType": "bootstrap", "aLengthMenu": [[10, 25, 50, 100, -1], ["10", "25", "50", "100", "All"]], "bAutoWidth": false, "bProcessing": true, "bServerSide": true, "sAjaxSource": "odata/exceptionmessages", "aoColumnDefs": [ { "aTargets": [0], "mData": "ExceptionMessageId" }, { "aTargets": [1], "mData": "Queue" }, { "aTargets": [2], "mData": "Exchange" }, { "aTargets": [3], "mData": "MessageType" }, { "aTargets": [4], "mData": null, "mRender": function(data, type, full) { return ''; } } ], "fnServerData": fnServerOData, "iODataVersion": 3, "bUseODataViaJSONP": false, "oLanguage": { "sLengthMenu": "_MENU_ records per page" } });
alexvance89 commented 10 years ago

Looks like i fixed this by setting the mData to the id property of my data coming back.

JocaPC commented 10 years ago

Hi, When query is sent, connector goes through all columns and use sTitle, mData (if it is a string) or sName and build a list that should be taken from OData service. You should set them to null if you want to skip column. Let me know is this fine with you.

Jovan