首页 > 解决方案 > javascript __proto__:使用 kendoComboBox 时 init 和 object 之间的区别

问题描述

我尝试将 KendoComboBox 与以下配置的数据源一起使用

....
 dataSource: {
    type: "json",
    serverFiltering: true,
    transport: {
        read: {
            url: __url,
            contentType: "application/json;",
            dataType: "json"
        }
    }
},
....

这就是我从 php 发送的内容:

.....
$searchResult[] = array(
    'value' => $object->getCode(),
    'text' => $object->getCode(),
    'pieceDetails' => $object,
    'rowsDetails' => $object->getRows()->toArray(),
);
return new JsonResponse($searchResult);

但是当我尝试在控制台浏览器中的更改事件之后显示选定的数据项时

change: function (e) {
    var object = this.dataItem();
    console.log(object);
}

我发现这个结果是这样的:

init {_events: {…}, _handlers: {…}, value: "BCC/0025", text: "BCC/0025", pieceDetails: init, …}
parent: ƒ ()
pieceDetails: init {_events: {…}, _handlers: {…}, client: init, trLivraison: "1", trFacture: "0", …}
rowsDetails: init(3) [init, init, init, type: ƒ, _events: {…}, parent: ƒ]
text: "BCC/0025"
uid: "12472ae6-0baa-4ae2-a78b-0a980d1c8d17"
value: "BCC/0025"
_events: {change: Array(1)}
_handlers: {pieceDetails: {…}, rowsDetails: {…}}
__proto__: init

那么我怎样才能只恢复选定的对象,就像我从一个简单的 ajax 响应中恢复一样:

{pieceDetails: {…}, rowsDetails: Array(3), mtRpGlobal: 0}
pieceDetails: {client: {…}, trLivraison: "1", trFacture: "0", code: "BCC/0025", date: {…}, …}
rowsDetails: (3) [{…}, {…}, {…}]
__proto__: Object

__proto__: init还有一个问题和有什么区别 __proto__: Object

标签: javascriptajaxkendo-combobox

解决方案


推荐阅读