var dataSource = new kendo.data.DataSource({ error : function(e) { alert(e.responseText); //提示錯誤。 }, transport : { read : { url : "index.php?r=datadictionary/ReadDict2Data", dataType : "json", type : "post" }, update : { url : "index.php?r=datadictionary/UpdateDict2Data", dataType : "json", type : 'post' }, destroy : { url : "index.php?r=datadictionary/DeleteDict2Data", dataType : "json", type : 'post' }, create : { url : "index.php?r=datadictionary/CreateDict2Data", dataType : "json", type : "post" }, parameterMap : function(options, operation) { if (operation !== "read" && options.models) { return { models : kendo.stringify(options.models) }; } } }, batch : true, pageSize : 5, schema : { model : { id : "id", fields : { id : { editable : false, //是否能被編輯 nullable : true //不可見。 }, seq : { type : "number" }, fldname : { type : "string" }, fldcaption : { type : "string" }, fldtype : { type : "string" }, fldlength : { type : "string" }, is_notnull : { type : "number" }, defvalue : { type : "string" }, remark : { type : "string" }, tblid : { editable : false, nullable : true }, } } } }); $("#grid").kendoGrid({ toolbar : [ "create" ], dataSource : dataSource, /* pageSize: 10, */ /* * serverPaging: true, //多次讀取服務器數據 serverFiltering: true, //服務器過濾 * serverSorting: true //服務器排序 */ /* filterable: true, */ /* sortable: true, */ resizable:true, //是否可調整字段寬長度 pageable : true, scrollable:false, columns : [ { field : "seq", //數組key title : "seq", //名字。 width : "80px" }, { field : "fldname", title : "fldname", width : "80px" }, { field : "fldcaption", title : "fldcaption", width : "80px" }, { field : "fldtype", title : "fldtype", width : "80px" }, { field : "fldlength", title : "fldlength", width : "80px" }, { field : "is_notnull", title : "is_notnull", width : "80px" }, { field : "defvalue", title : "defvalue", width : "80px" }, { field : "remark", title : "remark", width : "80px" }, /* * { field:"tblid", title:"tblid", width: "80px" }, */ { command : [ "edit", "destroy" ], title : "operation", width : "100px" }, ], editable : 'inline', //‘inline’樣式。 });