Grid javascript configuration api
Name Surname Marital status Age Birthday Employed
Joe Crosswave Married 31 1/5/1988 False
Merry Lisel Widowed 41 5/6/1978
Henry Crux Single 28 11/19/1990 True
Cody Jurut 49 8/11/1970 False
Javascript configuration

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
});

Javascript methods

// 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();

Javascript events

var grid = document.querySelector('.mvc-grid');

// Triggered when grid's row is clicked
grid.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
grid.addEventListener('reloadstart', function (e) {
    e.detail.grid - grid's instance.
});

// Triggered after grid stop loading
grid.addEventListener('reloadend', function (e) {
    e.detail.grid - grid's instance.
});

// Triggered after grid reload fails
grid.addEventListener('reloadfail', function (e) {
    e.detail.result - failed ajax response result.
    e.detail.grid - grid's instance.
});