【发布时间】:2016-03-15 14:02:54
【问题描述】:
我在 MVC 应用程序中使用 JQgrid。我得到了这样的要求,一列应该在添加向导中分成 3 个文本框。默认情况下,它是一个文本框。 让我知道任何相同的解决方案。
我需要在 3 个文本框中输入邮政编码,保存时我需要合并所有内容并添加到单个字段 这是代码:
var mydata = [{
zip : "23-12-13",
name: "Toronto",
country: "Canada",
continent: "North America"
}, {
zip : "23-12-13",
name: "New York City",
country: "USA",
continent: "North America"
}, {
zip : "23-12-13",
name: "Silicon Valley",
country: "USA",
continent: "North America"
}, {
zip : "23-12-13",
name: "Paris",
country: "France",
continent: "Europe"
}]
$("#grid").jqGrid({
data: mydata,
datatype: "local",
colNames: ['Zip/Postal',"Name", "Country", "Continent"],
colModel: [
{name:'Zip/Postal',index:'zip', editable: true,},
{
name: 'name',
index: 'name',
editable: true,
}, {
name: 'country',
index: 'country',
editable: true,
}, {
name: 'continent',
index: 'continent',
editable: true,
}],
pager: '#pager',
'cellEdit': true,
'cellsubmit' : 'clientArray',
editurl: 'clientArray',
pager: "#jqGridPager",
loadComplete: function () {
}
}).navGrid('#jqGridPager',
// the buttons to appear on the toolbar of the grid
{ Add : true },
{
url: '@Url.Action("Add", "Add")',
height: 'auto',
modal: true,
addCaption: "Add: ",
closeAfterAdd: false,
recreateForm: true,
beforeShowForm: function () {
}
afterShowForm:function () {
}
【问题讨论】:
-
请提供代码,如果你能提供一个使用 JSFIDDLE 的问题演示会更有帮助
-
代码附在上面
标签: jqgrid free-jqgrid