Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 剑道ui下拉列表未绑定_Jquery_Kendo Ui - Fatal编程技术网

Jquery 剑道ui下拉列表未绑定

Jquery 剑道ui下拉列表未绑定,jquery,kendo-ui,Jquery,Kendo Ui,我正在使用剑道UI内联编辑和下拉列表。 在我的代码中,我从控制器函数中获取JSON值 下拉列表未绑定此JSON数据,它显示错误,因为无法识别e.slice $("#orderItems-grid").kendoGrid({ dataSource: datasource, columns: [{ field: "Orderref", title: "Order Ref", editable:

我正在使用剑道UI内联编辑和下拉列表。 在我的代码中,我从控制器函数中获取JSON值

下拉列表未绑定此JSON数据,它显示错误,因为无法识别e.slice

 $("#orderItems-grid").kendoGrid({
        dataSource: datasource,
        columns: [{
            field: "Orderref",
            title: "Order Ref",
            editable: false
        }, {
            field: "ProductRef",
            title: "Product Ref",
            editable: false
        }, {
            field: "ProductNotes",
            title: "Product Notes",
            editable: false
        }, {
            field: "OrderStatusId",
            title: "Order Status",
            template: "#=OrderStatus#",
            editor: function (container) {
                var input = $('<input id="OrderStatusId" name="OrderStatusId">');
            input.appendTo(container);
            input.kendoDropDownList({
                dataTextField: "Value",
                dataValueField: "Key",                    
                dataSource: {
                    transport: {
                        read: {                                
                            url: "/Order/GetOrderStatusListForDD",
                            type: "POST",
                            dataType:"json"
                        }
                    }
                }

            }).appendTo(container);
        }
    },
    { command: { name: "edit", text: "Edit Status" } }],
    editable: "inline"
});
$(“#订单项网格”).kendoGrid({
数据源:数据源,
栏目:[{
字段:“Orderref”,
标题:“订单编号”,
可编辑:false
}, {
字段:“ProductRef”,
标题:“产品参考号”,
可编辑:false
}, {
字段:“ProductNotes”,
标题:“产品说明”,
可编辑:false
}, {
字段:“OrderStatusId”,
标题:“订单状态”,
模板:“#=订单状态”,
编辑器:函数(容器){
变量输入=$('');
输入。附加到(容器);
input.kendoDropDownList({
dataTextField:“值”,
dataValueField:“密钥”,
数据源:{
运输:{
读:{
url:“/Order/GetOrderStatusListForDD”,
类型:“POST”,
数据类型:“json”
}
}
}
}).附在(容器)上;
}
},
{命令:{名称:“编辑”,文本:“编辑状态”}}],
可编辑:“内联”
});

我的JSON结果是

{ “16”:“分配给领料队列”, “2”:“等待批准”, “10”:“等待下订单”, “9”:“等待库存”, “6”:“已取消”, “14”:“取消并重置产品”, “7”:“拒绝”, “8”:“中止”, “11”:“已停产并找到替代品”, “15”:“已开具发票”, “1”:“收到订单”, “3”:“订单发送给供应商”, “5”:“已装运”, “4”:“存储区” }您有两次。附加到(容器)。试试这个:

editor: function (container, options) {
    $('<input data-bind="value:' + options.field + '"/>')
        .appendTo(container)
        .kendoDropDownList({
            dataTextField: "Value",
            dataValueField: "Key",  
            dataSource: {
                transport: {
                    read: {
                        url: "/Order/GetOrderStatusListForDD",
                        type: "POST",
                        dataType: "json"
                    }
                }
            }
        });
    }
编辑器:函数(容器、选项){
$('')
.appendTo(容器)
.kendoDropDownList({
dataTextField:“值”,
dataValueField:“密钥”,
数据源:{
运输:{
阅读:{
url:“/Order/GetOrderStatusListForDD”,
类型:“POST”,
数据类型:“json”
}
}
}
});
}

更新:在GetOrderStatusListford()操作中,结果必须实现IEnumerable,然后返回Json(结果)将返回正确的Json

您好,谢谢您的回复。但我仍然得到了错误,因为e.slice不是一个函数,而上面我提到了我的JSON结果数据。请建议如何将此数据绑定到剑道ui下拉列表。您的json应该是一个数组,请检查此项。我现在使用stringbuilder更改了json。“{{Key:16,值:分配给领料队列},{Key:2,值:等待批准},{Key:10,值:等待下单},{Key:9,值:等待库存},{Key:6,值:取消},{Key:14,值:取消和产品重置},{Key:7,值:拒绝},{Key:8,值:中断},{Key:11,值:中断和找到替代品},{Key:15,值:发票},”,{Key:1,Value:Order Received},{Key:3,Value:Order sent to Supplier},{Key:5,Value:Shipped},{Key:4,Value:Storage Area}]}。但是现在在绑定下拉列表中加载的未定义的值时。{Key:2,Value:“waiting Approval”}-为值添加引号,因为它是正确的jquery版本?是的。如何使用类似于{“Key”的keyvalue对显示这个json:“16”,“值”:“分配给领料队列”}