简体   繁体   中英

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 :)

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'); $('#TableContainer').jtable({ }); $('#TableContainer').jtable('destroy');

then you need load JTable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM