JEdi​​table 在 MVC 3 上使用 Select

发布于 2024-11-11 00:25:13 字数 1859 浏览 1 评论 0原文

我目前想使用数据表显示数据列表。我希望能够内联编辑记录。我可以毫无问题地执行那些。问题是,当我尝试在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乖乖公主 2024-11-18 00:25:13

我终于设法从 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文