Welcome to my Blog - Vimalraj
1. jqgrid arrange the row (up and down) with subgrid on button click
Adding jqgrid row up and down arrange button. Write this following code after #pager settings this code first will do the collapse and remove subgrid and add the subgrid again the same row.
.navButtonAdd('#pager',
{
caption: "up",
buttonicon: "ui-icon-arrowthick-1-n",
onClickButton: function () {
var rowid = grid.jqGrid('getGridParam', 'selrow');
if (rowid == null) {
alert("Please Select Row")
}
else {
$(".ui-subgrid").remove();
$('#prods').trigger("jqGridAfterInsertRow");
var GridRows = $("#prods")[0].rows;
for (iRow = 0; iRow < GridRows.length; iRow++) {
$("#prods").jqGrid('collapseSubGridRow', iRow);
}
var selected_row = $('#' + rowid);
selected_row.insertBefore(selected_row.prev());
}
},
position: "last",
title: "",
cursor: "pointer"
})
.navButtonAdd('#pager',
{
caption: "Down",
buttonicon: "ui-icon-arrowthick-1-s",
onClickButton: function () {
var rowid = grid.jqGrid('getGridParam', 'selrow');
if (rowid == null) {
alert("Please Select Row")
}
else {
$(".ui-subgrid").remove();
var GridRows = $("#prods")[0].rows;
for (iRow = 0; iRow < GridRows.length; iRow++) {
$("#prods").jqGrid('collapseSubGridRow', iRow);
}
var selected_row = $('#' + rowid);
selected_row.insertAfter(selected_row.next());
}
},
position: "last",
title: "",
cursor: "pointer"
}
{
caption: "up",
buttonicon: "ui-icon-arrowthick-1-n",
onClickButton: function () {
var rowid = grid.jqGrid('getGridParam', 'selrow');
if (rowid == null) {
alert("Please Select Row")
}
else {
$(".ui-subgrid").remove();
$('#prods').trigger("jqGridAfterInsertRow");
var GridRows = $("#prods")[0].rows;
for (iRow = 0; iRow < GridRows.length; iRow++) {
$("#prods").jqGrid('collapseSubGridRow', iRow);
}
var selected_row = $('#' + rowid);
selected_row.insertBefore(selected_row.prev());
}
},
position: "last",
title: "",
cursor: "pointer"
})
.navButtonAdd('#pager',
{
caption: "Down",
buttonicon: "ui-icon-arrowthick-1-s",
onClickButton: function () {
var rowid = grid.jqGrid('getGridParam', 'selrow');
if (rowid == null) {
alert("Please Select Row")
}
else {
$(".ui-subgrid").remove();
var GridRows = $("#prods")[0].rows;
for (iRow = 0; iRow < GridRows.length; iRow++) {
$("#prods").jqGrid('collapseSubGridRow', iRow);
}
var selected_row = $('#' + rowid);
selected_row.insertAfter(selected_row.next());
}
},
position: "last",
title: "",
cursor: "pointer"
}