簡體   English   中英

如何通過extjs 4.2在Ext.create(“ Ext.window.Window”)中進行roweditor

[英]how do roweditor in Ext.create(“Ext.window.Window”) by extjs 4.2

extjs 4.2如何在Ext.create(“ Ext.window.Window”)中添加roweditor。
現在,我可以在網格中使用roweditor,但是我想在Ext.create(“ Ext.window.Window”)時使用roweditor。
如果我的代碼有錯誤,請告訴我!
這是我的extjs代碼,請幫助我!

 function sync1() { var sm = grid.getSelectionModel(); var data1=[]; var rec = sm.getSelection(); $.each(rec,function(i,item) { data1[i]=item.data.EQ_NO; }); store1 = Ext.create("Ext.data.Store", { autoLoad : true, //自動載入autoSync : false, //false為批量修改,預設是false,true代表一經修改會自動呼叫下面的api動作proxy : { //store資料來源地處理方式type : "ajax", api : { //設定四種後端操作程式 (CRUD, 增讀改刪) 即可在編輯完畢後立即更新後端資料庫,保持前後端同步read : "pocServlet?action=test&eq_no="+ data1, creat : undefined, update : "pocServlet?action=updateData", destroy : "pocServlet?action=deleteData", }, reader : { type : "json", totalProperty : "totalProperty", //root : "root", //idProperty : "id" }, writer : { type : "json", encode : true, //讓servlet能看懂writeAllFields : true, allowSingle : false, root : "data" //後端getParameter的參數名稱}, listeners : {//Exception Handler for the Ajax Request exception : function(proxy,response,operation) { var error = Ext.decode(response.responseText); Ext.MessageBox.show({ title : 'RULE DETAILS REMOTE EXCEPTION', msg : error.message, icon : Ext.MessageBox.ERROR, buttons : Ext.Msg.OK }); } } }, listeners : { write : function(proxy,operation) { console.log("writeResponseText="+ operation.response.responseText); if (operation.response.responseText != 0) { alert("Pass"); } else { alert("Fail"); } } }, fields : [ { name : "EQ_NO" }, { name : "REMARK" }, { name : "POSITION" }, { name : "MODIFY_USER" }, { name : "MODIFY_DATE" }, ] }); columns1 = [{ header : "EQ.NO.", dataIndex : "EQ_NO", width : 200, locked : true, }, { header : "Remark", dataIndex : "REMARK", width : 200, editor : {} }, { header : "Position", dataIndex : "POSITION", width : 200, editor : {} }, { header : "Modify_User", dataIndex : "MODIFY_USER", width : 200 }, { header : "Modify_Date", dataIndex : "MODIFY_DATE", width : 200 } ] win = Ext.create("Ext.window.Window", { title: "Select Visit Vessel", layout: 'fit', maximizable: true, width: 900, height: 400, tbar: { xtype: 'toolbar', frame: true, border: false, padding: 2 }, items: [{ xtype: 'grid', store: store1, columns: columns1, }] }); win.show(); }; 

我為您制作了一個小提琴示例,以顯示行編輯的工作原理:

https://fiddle.sencha.com/#fiddle/g2t

基本上,您必須在要用作編輯選項的Editor屬性中設置適當的表單字段。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM