Name | Surname | Marital status | Age | Birthday | Employed |
---|---|---|---|---|---|
Joe | Crosswave | Married | 36 | 1/5/1988 | False |
Merry | Lisel | Widowed | 46 | 5/6/1978 | |
Henry | Crux | Single | 34 | 11/19/1990 | True |
Cody | Jurut | 54 | 8/11/1970 | False |
new MvcGrid(document.querySelector('.mvc-grid'), {
sourceUrl: 'IndexGrid', // Grid source url string
query: 'search=test', // Grid query string
requestType: 'get', // Ajax grid request type
filters: {
// Grid filter constructors to extend or use
'boolean': CustomBooleanFilter
},
loadingDelay: 300 // Loading block visiblity delay on ajax grid, null indicates no loading screen
});
// Reloads the grid
new MvcGrid(document.querySelector('.mvc-grid')).reload();
// Clears all query values associated with the grid name
new MvcGrid(document.querySelector('.mvc-grid')).clearQuery();
var grid = document.querySelector('.mvc-grid');
// Triggered when grid's row is clicked. It's recommended to use event delegation in ajax scenarios.
document.addEventListener('rowclick', function(e) {
e.detail.data - clicked row's data from columns.
e.detail.grid - grid's instance.
e.detail.originalEvent - original tr click event which triggered the rowclick.
});
// Triggered before grid starts loading. It's recommended to use event delegation in ajax scenarios.
document.addEventListener('reloadstart', function (e) {
e.detail.grid - grid's instance.
});
// Triggered after grid stop loading. It's recommended to use event delegation in ajax scenarios.
document.addEventListener('reloadend', function (e) {
e.detail.grid - grid's instance.
});
// Triggered after grid reload fails. It's recommended to use event delegation in ajax scenarios.
document.addEventListener('reloadfail', function (e) {
e.detail.result - failed ajax response result.
e.detail.grid - grid's instance.
});