Handling request error for remote data Grid
Handling the event and canceling it to retain whatever grid functionality was available and perhaps replace the data source
HTML
<script src="http://cdn-na.infragistics.com/jquery/20131/latest/js/infragistics.loader.js"></script>
<div id="Grid1"></div>
CSS
body > span.ui-igloadingmsg > p {
position: relative;
width: 18em;
left: -8em;
/* Consider some styling for the text so it's clear on top of the grid text.
*/
background-color: rgba(234, 234, 234, 0.9);
}
JavaScript
$(document).ready(function(){
$(document).ajaxError(function(){
alert("An error occured!");
});
});
$.ig.loader({
scriptPath: 'http://cdn-na.infragistics.com/jquery/20131/latest/js/',
cssPath: 'http://cdn-na.infragistics.com/jquery/20131/latest/css/',
theme: 'metro'
});
$.ig.loader("igGrid.Paging.Hiding", function () {
console.log("Entrei 2")
$("#Grid1").igGrid({
dataSource: 'http://theDataSourceThatAlwaysfails/',
primaryKey: 'id',
autoGenerateColumns: false,
autoGenerateLayouts: false,
columns: [{
key: 'id',
dataType: 'number',
headerText: 'Id'
}, {
key: 'fullname',
dataType: 'string',
headerText: 'Full Name'
}, {
key: 'fname',
dataType: 'string',
headerText: 'First name'
}, {
key: 'lname',
dataType: 'string',
headerText: 'Last Name'
}, {
key: 'username',
dataType: 'string',
headerText: 'User Name'
}, {
key: 'userLevel',
dataType: 'string',
headerText: 'User Level'
}, {
key: 'userGroupId',
dataType: 'string',
headerText: 'User Group'
}, {
key: 'email',
dataType: 'string',
headerText: 'Email'
}, {
key: 'status',
dataType: 'bool',
headerText: 'Status'
}],
features: [{
name: "Paging"
}, {
name: 'Hiding'
}]
});
});
$(document).ajaxComplete(function(){
alert("An error occured!");
});
//$(document).delegate("#Grid1", 'iggridrequesterror', function (evt, ui) {
// //return reference to igGrid
// alert("yaye");
// return false;
//});