我試圖使用edittype: 「選擇」,格式: 「選擇」 和editoptions:{值: '1:類型1; 2:2型'}在我colModeljqGrid的下拉菜單中選擇editoptions
colModel : [
{name:'pk', index:'pk', width:20, sortable:true, jsonmap:'pk',
sorttype:'integer'},
{name:'id', index:'id', align:'left', jsonmap:'fields.id',
sortable:true, editable:true, edittype:'select', formatter:'select',
editoptions:{value:'1:value1;2:value2;3:value3'},
{name:'type', index:'type', width:100,align:'center',
jsonmap:'fields.type', sortable:true,editable:true}
]
但在json對象中返回的id值不是一個字符串(它沒有引號)。如果我刪除edittype和editoptions id值出現在網格的列,但是當我包括在colMode定義edittype,格式化和editoptions我得到的JavaScript錯誤
(E||"").replace is not a function
失敗看起來像JSON對象
{ "pk": 120
"model": "myModel"
"fields": {
"id": 1,
"type": "aType"
}
}
該id值沒有引號。
我在其他網格中使用edittype,formatter和editoptions,但是我正在使用的值是一個字符(在json對象中它被引號括起來)並且完美地工作。
我只是猜測問題是沒有引號,但我不確定。有沒有人見過這個?
問候 安德魯
需要一些更多的信息。什麼js文件是拋出你上面列出的錯誤,以及哪一行?並試圖用json對象粘貼回服務器? – 2009-11-02 23:36:59
它停在的文件是jquery-1.3.2.js lin 1067.它看起來像試圖修剪要返回的值。它不會嘗試粘貼回服務器,它假定將edit值中key:value對的值替換爲1的id值,在本例中爲value1。 – 2009-11-03 00:23:59