tabalinas / jsgrid-webapi

Sample project for jsgrid with WebAPI remote source

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot read property "Username"

singhswat opened this issue · comments

Hi,

Code snippet I'm using to display the data

https://github.com/tabalinas/jsgrid-webapi/blob/b25118d6b6ae41760fa08455b1050e8c57e9901e/Views/Home/Index.cshtml

$("#jsGrid").jsGrid({
            height: "50%",
            width: "100%",

            filtering: true,
            inserting: true,
            editing: true,
            sorting: true,
            paging: true,
            autoload: true,

            pageSize: 10,
            pageButtonCount: 5,

            deleteConfirm: "Do you really want to delete client?",

            controller: {
                loadData: function(filter) {
                    return $.ajax({
                        type: "GET",
                        url: "/api/data",
                        data: filter,
                        dataType: "json"
                    });
                }, ....

I'm getting this error when i F12 on browser and no data is displayed as it doesn't recognize the db col

jquery-3.3.1.js:3818 jQuery.Deferred exception: Cannot read property 'Username' of undefined TypeError: Cannot read property 'Username' of undefined
at d._getItemFieldValue (http://js-grid.com/js/jsgrid.min.js:7:11362)
at d._createCell (http://js-grid.com/js/jsgrid.min.js:7:11092)
at d. (http://js-grid.com/js/jsgrid.min.js:7:11027)
at c. (http://js-grid.com/js/jsgrid.min.js:7:7686)
at Function.each (http://localhost:50692/Scripts/jquery-3.3.1.js:354:19)
at d._eachField (http://js-grid.com/js/jsgrid.min.js:7:7642)
at d._renderCells (http://js-grid.com/js/jsgrid.min.js:7:10990)
at d._createRow (http://js-grid.com/js/jsgrid.min.js:7:10391)
at d._refreshContent (http://js-grid.com/js/jsgrid.min.js:7:9988)
at d.refresh (http://js-grid.com/js/jsgrid.min.js:7:9425) undefined
jQuery.Deferred.exceptionHook @ jquery-3.3.1.js:3818
jquery-3.3.1.js:3827 Uncaught TypeError: Cannot read property 'Username' of undefined
at d._getItemFieldValue (jsgrid.min.js:7)
at d._createCell (jsgrid.min.js:7)
at d. (jsgrid.min.js:7)
at c. (jsgrid.min.js:7)
at Function.each (jquery-3.3.1.js:354)
at d._eachField (jsgrid.min.js:7)
at d._renderCells (jsgrid.min.js:7)
at d._createRow (jsgrid.min.js:7)
at d._refreshContent (jsgrid.min.js:7)
at d.refresh (jsgrid.min.js:7)

Thanks for the help!

Could you show the response coming from the api (in Network tab of DevTools for instance)?