vpllan / jQuery.dataTables.oData

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

Sort order doesn't work for oData v4. #11

Open noakesey opened 9 years ago

noakesey commented 9 years ago

From my experience, asc and desc always appear in sSortDir_0 and so I updated the following locally. This needs more investigation

asOrderBy.push(oParams["mDataProp" + oParams["iSortCol" + i]] + " " + (oParams["sSortDir_0"] || ""));

worthy7 commented 7 years ago

Can you expand slightly as to where we should put this code, thanks

noakesey commented 7 years ago

Hi,

In jquery.dataTables.odata.js on about lines 88-96, I updated as follows locally:

    //Added if condition to fix blank filter issue
    if (asFilters.length > 0) {
        data.$filter = asFilters.join(" or ");
    }
    var asOrderBy = [];  // What about desc?  sSortDir_0 = "desc"
    for (var i = 0; i < oParams.iSortingCols; i++) {
        asOrderBy.push(oParams["mDataProp_" + oParams["iSortCol_" + i]] + " " + (oParams["sSortDir_0"] || ""));
    }
    data.$orderby = asOrderBy.join();

I never completed the project or attempted to update github - please do so if you find it makes things better...


From: Worthy7 notifications@github.com Sent: 19 January 2017 09:26 To: vpllan/jQuery.dataTables.oData Cc: noakesey; Author Subject: Re: [vpllan/jQuery.dataTables.oData] Sort order doesn't work for oData v4. (#11)

Can you expand slightly as to where we should put this code, thanks

- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/vpllan/jQuery.dataTables.oData/issues/11#issuecomment-273722358, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKeA1opoTQw_NJPI0Rc87ufNRXs3nehlks5rTyxCgaJpZM4Djjbp.