i'm starter in jqGrid. i write this code for Genereate Grid
grid.jqGrid({
url: 'jQGridHandler.ashx',
postData: { ActionPage: 'Report5',type:'Fill' },
datatype: 'json',
height: 530,
colNames: ['id','UnitPrice'],
colModel: [
{ name: 'Id', sortable: true, search: true, editable: false, hidden: true,
key: true },
{ name: 'UnitPrice', shrinkToFit: true, width: 50,
searchoptions: {
sopt: ['eq', 'ne', , 'le', 'ge'],
dataInit: function (elem) {
$(elem).keyup(function () {
var str = $(this).val();
str = str.replace( /,/g, "" );
$(this).val(addCommas(str));
});
}
}}
],
gridview: true,
search: true,
rowNum: 100,
rowList: [100, 200, 300],
pager: '#pager',
viewrecords: true,
rownumbers: true,
footerrow: true, userDataOnFooter: true, altRows: true,
});
grid.jqGrid('navGrid', '#pager', { add: false, edit: false, del: false, search: true },
{},
{},
{},
{ multipleSearch: true });
grid.jqGrid('filterToolbar', { defaultSearch: 'cn', stringResult: true });
function addCommas(nStr) {
nStr += '';
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
i want user when in search box select unitPrice and type number, number 3 char 3 char sperate with ,
, i write function addCommas and work good, bute when user enter price and press search button the unit price not send to server.
example in this picture
and after click in search button
please help me. thanks all