Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to open jquery datatable on model popup.
but i am getting blank grid. Data is not loaded.

What I have tried:

open model popup function :

modal.modal().load(actionurl, function () {
                            modal.show();
                            debugger;
                            
                            initializeGrid();
                            
                        });


Grid code is as below:

var initializeGrid = function () {
            debugger;
            tblZgs = null;
            var jsonData = [{ "userID": "1", "userName": "name1" }, { "userID": "2", "userName": "name2" }, { "userID": "3", "userName": "name3" }];
            if (!$.fn.DataTable.isDataTable($tbl_zgs)) {
                tblZgs = $tbl_zgs.dataTable({
                    data: jsonData,
                    columns: [
                        { data: 'userID' },
                        { data: 'userName' }
                    ]
                });
                //tblZgs.columns.adjust().draw();
            }


Any one please help me.
Posted
Comments
Herman<T>.Instance 21-Jun-18 6:42am    
why check on $.fn.DataTable.isDataTable($tbl_zgs)?
tblZgs = null; you stated!
viprat 21-Jun-18 7:22am    
just for testing. i found some code like this on gogle so tried. but not working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900