This topic contains 3 replies, has 3 voices, and was last updated by Zis Zis 2 years, 10 months ago.

Additional parameters from server for Ajax Datatable


  • Volder
    Participant

    Posts: 1
    Member Reply #1781

    Hello

    I’m using Ajax Datatables in Admin layout.

    I need to pass additional parameter to client side from server and execute some action based on this, e.g. reduce the number of notifications displayed in labels on the page, when the notifications were deleted via ajax.

    How can I pass this? I see there is special “onDataLoad” method, which allows to execute script on client side when the table is redrawn, but how to pass/get additional parameters from server in order to define what to do?

    Sean
    Sean
    Keymaster

    Posts: 4444
    Support Staff Reply #1805

    Hi :),

    Please replace datatable.js with attached one as i exposed server side json response object into onSuccess function so you can get access to response parameters as shown below:

    onSuccess: function (grid, response) {
    // grid: grid object
    // response: json object of server side ajax response
    // execute some code after table records loaded
    },

    To pass a parameter to server side you can existing method as shown below before(or try after) grid.init() call:

    grid.setAjaxParam(“new_param”, “122323”);

    I hope the above instruction will be helpful.

    If you need any further assistance please let us know.

    Thanks.

    Attachments:
    You must be logged in to view attached files.

    Volder
    Participant

    Posts: 1
    Member Reply #1823

    Worked like a charm, thanks for such a nice support!

    Zis
    Zis
    Participant

    Posts: 150
    Support Staff Reply #1824

    Dear Volder,

    Thank you for your patience and feedback.

    We would also like to say a big thank you for trying our product and service. As it continues to evolve and improve we hope that you will enjoy to see how the Metronic journey is unfolding and developing.

    Stay tuned and give us a follow us on http://twitter.com/keenthemes

    All the very best for now. If ever we can be of assistance, please let us know.

    Cheers! 😉

You must be logged in to reply to this topic.