问题描述:

  1. I am successfully using Jqgrid with MVC .net 4.0, with pager showing Add-Edit-Delete buttons.

    On click on Add-Edit button the dialog box pops up and on click of submit button on the dialog box, 2. I am successfully updating data at server.

  2. On of the columns is using drop down list ( edittype: "select")

Now,

a. I want to validate some data on click of the Submit button.

b. I want to send "Id" instead of "text", of the "select" type column to the server, on submit click.

Thanks

网友答案:

jqGrid supports drop-down list (edittype:"select") where as the data you has ids, but the texts which corresponds to ids will be displayed in jqGrid. To have this behavior you should use select-formatter: (formatter:'select') additionally to the setting edittype:"select".

For example

{
    name: 'Country', width: 100, editable: true, formatter: 'select',
    stype:'select', searchoptions: { value: ':All;1:US;2:UK' },
    edittype: 'select', editoptions: { value: { '1':'US', '2':'UK' } }
}

Instead of value option you can load the same information per AJAX. In the case you can use dataUrl and if needed buildSelect option.

相关阅读:
Top