Deleting query parameters when using ColumnControl

Deleting query parameters when using ColumnControl

rweigelrweigel Posts: 4Questions: 2Answers: 0

Test Case: https://jsbin.com/bavabaq/edit?html,output

In the past, I've used

ajax.data = function (d) { delete d.columns; return d}

When I use columnControl, I get an error. See the test case comments for

This question has an accepted answers - jump to answer

Answers

  • rweigelrweigel Posts: 4Questions: 2Answers: 0

    See the test case comments for the line that is causing the error:

    n.page.info().serverSide && n.on("preXhr.DT", function(t, e, n) {
    n.columns[i._idx].columnControl || (n.columns[i._idx].columnControl = {});

    Is it possible to remove the columns query parameter from being sent to the server when using columnControl?

  • kthorngrenkthorngren Posts: 22,286Questions: 26Answers: 5,125

    According to the ColumnControl server side processing docs ColumnControl adds column search information to the columns object. It looks like that error probably comes from the columnControl.js include. @allan might be willing to add a check to make sure the columns object exists as part of that statement and possibly in other areas of the code.

    Please explain why you are wanting/needing to remove the columns object from the server side processing data. Maybe we can provide an alternative.

    Kevin

  • kthorngrenkthorngren Posts: 22,286Questions: 26Answers: 5,125

    One option might be to use preXhr to remove the columns object instead of ajax.data. Possibly it will execute after the ColumnControl preXhr event you show above thus eliminating the error.

    Kevin

  • rweigelrweigel Posts: 4Questions: 2Answers: 0

    Thanks!

    That did not resolve the issue. I think I need to modify my server-side API to accept columns. The reason I was deleting columns is that I wanted to use a simpler server API syntax because I was also using the API for other purposes.

    Probably the docs for ColumnControl should be updated. I have encountered old posts where deletion of attributes is allowed in the way I was doing it.

  • allanallan Posts: 65,162Questions: 1Answers: 10,796 Site admin
    Answer ✓

    Hi,

    You are right - I should allow for data being deleted from the submitted object, and hadn't considered that here. I've committed a fix to ColumnControl will account for that in future.

    The nightly build will be up to date with the change soon, and it will be in the next release.

    Allan

Sign In or Register to comment.