Hi Friends,
how to get auto incremented Serial no in jqgrid when i m adding data in jqgrid??
Plesae help me if you have knowledge in jqgrid....
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Khargesh RajputPosted Dec 18, 2014, 6:43 AM
http://www.trirand.net/examples/grid/appearance/rownumbers/default.aspx
view C# tab
here row numer are on selected index.
we can use this on page load
dipti prasadPosted Dec 18, 2014, 5:55 AM
but i dont know how to apply this code???
my jqgrid:
$("#list").jqGrid({
url: '/BankPay/GetRecords/',
datatype: "Json",
contentType: "application/json; charset-utf-8",
mtype: 'GET',
colNames: ['Sr No.', 'Code', 'Plan/BU', 'Account Description', 'Sub Ldgr', 'Debit', 'Credit', 'Cost Center', 'Profit Center', 'Chq Type', 'Narr'],
colModel: [
{ name: 'Sno', index: 'Sno', align: "center", sortable: false, editable: true, editoptions: { size: 5 } },
{ name: 'Code', index: 'Code', align: "center", sortable: false, editable: true, edittype: 'text' },
{ name: 'Branch', index: 'Branch', align: "right", sortable: false, editable: true, edittype: 'text', editoptions: { dataInit: function (elem) { NameSearch(elem) } }},
{ name: 'BankCode', index: 'BankCode', align: "right", sortable: false, editable: true, edittype: 'text', editoptions: { maxlength: 6 } },
{ name: 'SubLdgr', index: 'SubLdgr', align: "right", sortable: false, editable: true, edittype: 'text' },
{ name: 'Debit', index: 'Debit', align: "right", sortable: false, editable: true, edittype: 'text', formatter: 'integer' },
{ name: 'Credit', index: 'Credit', align: "right", sortable: false, editable: true, edittype: 'text' },
{ name: 'CostCentre', index: 'CostCentre', align: "center", sortable: false, editable: true, edittype: 'text' },
{ name: 'ProfitCenter', index: 'ProfitCenter', align: "center", sortable: false, editable: true, edittype: 'text' },
{ name: 'Cheque', index: 'Cheque', align: "center", sortable: false, editable: true, edittype: 'text' },
{ name: 'Narr', index: 'Narr', align: "center", sortable: false, editable: true, edittype: 'text' }
],
pager: "#pager",
rowNum: 5,
rownumbers: true,
rowList: [5, 10, 15],
height: 'auto',
//height:'110',
width: '940',
viewrecords: true,
reloadAfterSubmit: true,
multiselect: true,
reloadAfterSubmit: true,
gridview: true,
sortname: 'Sno',
editurl: '/BankPay/EditRecords/',
loadonce: true,
reloadAfterSubmit: true,
footerrow: true,
loadComplete: function () {
var $grid = $("#list");
var sum = $grid.jqGrid('getCol', 'Debit', false, 'sum');
$grid.jqGrid('footerData', 'set', { SubLdgr: 'Total (Dbt/Crt):', Debit: sum });
var sum1 = $grid.jqGrid('getCol', 'Credit', false, 'sum');
$grid.jqGrid('footerData', 'set', { Total: 'Total:', Credit: sum1 });
},
userDataOnFooter: true,
caption: "Bank Payment",
});
jQuery("#list").jqGrid('navGrid', '#pager', {
edit: true,
edittext: "Edit",
add: true,
addtext: "Add",
del: true,
deltext: "Delete",
search: true,
searchtext: "Search",
refresh: true,
refreshtext: "Refresh",
alertcap: "Warning",
alertext: "Please Select Row",
});
please help me
Khargesh RajputPosted Dec 18, 2014, 5:48 AM
Together, you can get the id for the next row in your grid: