javascriptjqueryjquery-jtable

How do I reload Jquery jtable with change in URL on select event


Consider I am showing toppers of each subject from a DB using Jtable.I have integrated this with Spring MVC.

$('#TableContainer').jtable({
    //title: 'Members',
    selectOnRowClick:true,
    selecting: true, //Enable selecting 
    paging: true, //Enable paging
    pageSize: 10, //Set page size (default: 10)
    sorting: false, //Enable sorting
    actions: {
        listAction: myurl+'LoadMarks?subject='+subject,
    },

    fields: {
        ExamDate: {
            title: 'Exam Date',
        },
        StudentID: {
            title: 'Student',
        },
        Marks: {
            title: 'Marks Awarded',    
        }
    }
});

At page load I am using $('#TableContainer').jtable('load');

Now I need to make this dynamic by providing user a dropdown and on change of dropdown I need to reload jQuery jTable with respective columns.

If using $('#TableContainer').jtable('reload'); the url is getting called but I need to change ListAction variable (URL) and reload the page.
I need to change url and load/reload jTable
Thanks In advance :)


Solution

  • Finally Found the Answer

    I needed to destroy the Jtable. But,$('#TableContainer').jtable('destroy'); does not work you can do it by. refer link $('#TableContainer').jtable({ }); $('#TableContainer').jtable('destroy');

    then you need load JTable