Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
190
Javascript defined igGrid receive data and post back to MVC Controller
posted

Hi,

If I wanted to use a javascript based igGrid how would I use that with an MVC controller.  I'm looking to use this as I need the sortable function here:

$("#grid1").igGrid({
autoGenerateColumns: false,
autoCommit: false,
columns: [
{ headerText: "Product ID", key: "ProductID", dataType: "number" },
{ headerText: "Product Name", key: "Name", dataType: "string" },
{ headerText: "Product Number", key: "ProductNumber", dataType: "string" }
],
primaryKey: "ProductID",
dataSource: adventureWorks,
rowsRendered: function(evt, ui) {
// initialize sortable on the grid tbody
initSortable();
}
});
});
function initSortable() {
$( "#grid1 tbody" ).sortable({
containment: "parent",
start: function(evt, ui) {
var children = ui.item.children();
$("#grid1_headers thead th").each(function(ix, el) {
// set the width of each td to its header width
$(children[ix]).width($(el).width());
});
}
});

Please let me know how to push data from an MVC controller as well as to post back to that controller.

Conversely, how would I define an MVC databound Grid to use the initSortable function above.  I don't see the rowsRendered property exposed when using the MVC helper.  Please help, thanks!

Parents Reply Children
No Data