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