简体   繁体   中英

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

How do roweditor in Ext.create("Ext.window.Window") by extjs 4.2.
Now, I can roweditor in grid, but I want to roweditor when Ext.create("Ext.window.Window") .
If there is an error in my code, please tell me!!
this is my extjs code,please help me!!!!!

 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(); }; 

I made an fiddle example for you, to show how rowediting works:

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

Basically you have to set the appropriate form field in the editor property you want to use as editing option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM