Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I configure JQGrid and configure dropdown list in the JQGrid but while saving i am not able to find selected value not text but iam getting only selected text i am not able to find selected value.
this is jq Grid's colModel:

name: 'InvoiceFormatID', width: 10, search: false, label: 'Invoice Format', align: "center", editable: true, edittype: "select",
editoptions: {value: getAllSelectOptions()}

function getAllSelectOptions() {
var states = {
'3': 'PDF', '4': 'Excel'
};
return states;
}


on Save click i am calling below function

this.buildInvoiceFormatAndTemplateModel = function (invoiceFormatAndTemplate) {

var rows = invoiceFormatAndTemplate.jqGrid('getDataIDs');
var viewModel = "[";
for (i = 0; i < rows.length; i++) {
var rowData = invoiceFormatAndTemplate.jqGrid('getRowData', rows[i]);
var val = rowData;
if (i > 0)
viewModel += ",";
//This is the unlucky one
var vm = "{\"InvoiceFormatID\": \"" + val["InvoiceFormatID"] + "\",\"InvoiceTemplateID\":\"" + val["InvoiceTemplateID"] + "\" }";
viewModel += vm;
}

viewModel += "]";
return viewModel;
};

What I have tried:

I tried to capture selected value as {formatId:3,InvoiceTemplateID:5}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900