rstaib / jquery-bootgrid

Nice, sleek and intuitive. A grid control especially designed for bootstrap.
http://www.jquery-bootgrid.com
MIT License
973 stars 364 forks source link

Passing json variable to bootgrid table #434

Open amoriotechnology opened 1 year ago

amoriotechnology commented 1 year ago

I am trying to use ajax function in codeignitor to fetch data from the database and show the results in the bootgrid table. I received a valid json from controller. My json response is https://pastebin.com/As7gehP6

My script :

            $(function() {
                        var data = {
                            csrfName: csrfHash
                        };
                        $.ajax({
                                type: 'POST',
                                data: data,
                                dataType: "json",
                                url: '<?php echo base_url();?>Cinvoice/CheckProfarmaInvoiceList',
                                success: function(json, statut) {

                                    localStorage.setItem('json', JSON.stringify(json));
                                });
                        });

              var grid = $("#document_data").bootgrid({
                  ajax: false,
                  url: '<?php echo base_url();?>Cinvoice/CheckProfarmaInvoiceList'
              }); 

             grid.bootgrid('append', localStorage.getItem('json'));

But data is not displaying in bootgrid table,the table is empty and Showing 1 to 10 of 1792 entries My output is : git

Kindly helpme to solve this issue.