JEditable 在 MVC 3 上使用 Select
我目前想使用数据表显示数据列表。我希望能够内联编辑记录。我可以毫无问题地执行那些。问题是,当我尝试在 JEditable 的字段之一上使用下拉列表(选择)时,一切都卡在了哪里。
我想从 MSSQL 中的一个表中获取数据并将其转储到 data : "{ 'test' : 'test' }"
上。但我找不到办法做到这一点。我的 JS 知识不太好。
我有什么办法可以执行这个吗?带着这个问题,我包括我当前的代码: 这是我对 Datatables 和 JEditable 的初始化,
$(document).ready(function () {
$('#myItem').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": 'Items/AjaxDataProvider',
"sPaginationType": "full_numbers",
"aoColumns": [
{ "sName": "ID",
"bSearchable": false,
"bSortable": false,
"bVisible": false
},
{ "sName": "NAME" , "sWidth" : "20%" },
{ "sName": "UOM", "sWidth": "7%" },
{ "sName": "REMARKS", "sWidth" : "8%"},
{ "sName": "BARCODE", "sWidth": "8%" },
{ "sName": "WITH SERIAL", "sWidth": "10%" },
{ "sName": "MODEL" }
]
}).makeEditable({
sUpdateURL: "/Items/UpdateData",
sAddURL: "/Items/AddData",
sDeleteURL: "/Items/DeleteData",
aoColumns: [
{ },
{
type: "select",
onBlur: "submit",
data: "{ ???? : ???? }"
},
{ },
{ },
{ },
{ },
{ },
{ },
{ },
{ },
{ } ]
});
});
我想插入到 makeEditable 的 data
区域中,第二个区域是针对 UOM 的:
var selectData = from a in db.Table select new[] { Convert.ToString(m.ID), Convert.ToString(m.Name) };
任何人都可以帮我解决这个问题吗?
非常感谢先进的o/
I'm currently want to display a list of data using DataTables. And I want to be able to edit the record inline. I could execute those with no problem. The problem is, when I try to use drop down list(select) on one of the field for JEditable, that's when everything stuck to no where.
I would like to fetch the data from one of my table in MSSQL and dump it on data : "{ 'test' : 'test' }"
for example. but I cant find a way to do that. My JS knowledge is not that good.
Is there any way I could execute this? With this question, I include my current codes:
this is my initialization for Datatables and JEditable
$(document).ready(function () {
$('#myItem').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": 'Items/AjaxDataProvider',
"sPaginationType": "full_numbers",
"aoColumns": [
{ "sName": "ID",
"bSearchable": false,
"bSortable": false,
"bVisible": false
},
{ "sName": "NAME" , "sWidth" : "20%" },
{ "sName": "UOM", "sWidth": "7%" },
{ "sName": "REMARKS", "sWidth" : "8%"},
{ "sName": "BARCODE", "sWidth": "8%" },
{ "sName": "WITH SERIAL", "sWidth": "10%" },
{ "sName": "MODEL" }
]
}).makeEditable({
sUpdateURL: "/Items/UpdateData",
sAddURL: "/Items/AddData",
sDeleteURL: "/Items/DeleteData",
aoColumns: [
{ },
{
type: "select",
onBlur: "submit",
data: "{ ???? : ???? }"
},
{ },
{ },
{ },
{ },
{ },
{ },
{ },
{ },
{ } ]
});
});
I would like to insert into data
area in makeEditable for second which is for UOM from this result:
var selectData = from a in db.Table select new[] { Convert.ToString(m.ID), Convert.ToString(m.Name) };
Anyone could give me a hand on solving this one?
Thanks a lot in advanced o/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于设法从 SQL 中获取我的选择列表的值。这些步骤写在我的博客负零
I have finally manage to get the value for my selection list from SQL. The steps are written at my blog at Negative Zero