jQWidgets Forums
jQuery UI Widgets › Forums › Grid › How to subscribe on error loading data for grid
Tagged: #jqwidgets-grid, grid, javascript grid, jquery grid
This topic contains 1 reply, has 2 voices, and was last updated by Hristo 7 years, 6 months ago.
-
Author
-
My jqGrid fetch data from remote conntoler.
I did it conustuct likevar sourceGridInternih = { dataFields: [{ name: 'id', type: 'int' }, { name: 'sklId', type: 'int' }, { name: 'vsklId', type: 'int' },{ name: 'skl', type: 'string' }, { name: 'vskl', type: 'string' }, { name: 'datum', type: 'date' }, { name: 'datumDo', type: 'date' }, { name: 'broj', type: 'string' }, { name: 'status', type: 'string' }, { name: 'statuscode', type: 'string' }, { name: 'tag', type: 'string' }, { name: 'napomena', type: 'string' }, { name: 'izradio', type: 'string' } ], id: 'id', async: false, type: 'POST', dataType: 'json', url: '../../InterneNarudzbe/GridDokumenata', cache: false, formatData: function (data) { return { odDatuma: $("#odDatuma").val(), doDatuma: $("#doDatuma").val(), sklFilter: $("#filterSklIsporuci").val(), vsklFilter: $("#filterSklNarucici").val(), filterStatus: $("#filterStatus").val(), filterTag: $("#filterTag").val(), grupaRjFilter: $("#grupaRjFilter").val() }; }, data: {} }; var adapterGridInternih = new $.jqx.dataAdapter(sourceGridInternih, { formatData: function (data) { //data.tabelaId = tabelaId return data; } }); $(document).ready(function () { $("#gridInternih").jqxGrid({ source: adapterGridInternih }); });
This works perfectly,
In other places in code I do refres by$('#gridInternih').jqxGrid('updatebounddata', 'data');
Sometimes controller fail to response data to ajax call.
In that cases grid refreshes without rows.
And user get message There is no tow for displayIn chrome console I do get error
POST http://localhost:60208/InterneNarudzbe/GridDokumenata net::ERR_CONNECTION_REFUSED
But end users does not hold console open.I want to subscribe to this error so I can printout user error to explain him that tere was error.
Hello Admir Hodžić,
The
formatData
callback is a part of the DataAdapter. Please, take a look our API Documentation.
Also, you could find thereloadError(jqXHR, status, error)
a callback function called when the request has failed.
About the DataAdapter’s source it has determinated options – including the datafields have specific values. Possible values: ‘string’, ‘date’, ‘number’, ‘float’, ‘int’ and ‘bool’.Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.