Can we remove the some useless parameter while using serverside option?

Can we remove the some useless parameter while using serverside option?

JN9527JN9527 Posts: 4Questions: 3Answers: 0

I am using the serverside option to paging the data. I want to customize my url while click the page button. I don't want some sent parameters in the URL. Such as order[i][column],columns[i][data],columns[i][name],columns[i][orderable] ...etc. Then I use the customize URL to get data from server. Is there any solution???

many thanks

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,836Questions: 1Answers: 10,518 Site admin
    Answer ✓

    Yes - use the ajax.data option to delete the parameters you don't want. delete data.columns; for example would remove all of the column information. Refine as needed :smile:.

    Allan

  • JN9527JN9527 Posts: 4Questions: 3Answers: 0

    Thanks allan, can you give me an example? I not quite understand the delete data.columns;

  • allanallan Posts: 63,836Questions: 1Answers: 10,518 Site admin
    Answer ✓
    ajax: {
      ...,
      data: function ( d ) {
        delete d.columns;
      }
    }
    

    If you only want to delete specific properties from the objects in the columns array, you'd need to loop over it and delete each property from each object. A simple for loop would do that.

    Allan

This discussion has been closed.