如何在 Ext.create( "Ext.window.Window" ) 中通过 extjs 4.2 进行行编辑器



How do roweditor in Ext.create("Ext.window.Window") by extjs 4.2.
现在,我可以在网格中行编辑器,但我想在 Ext.create("Ext.window.Window") 时行编辑器。
如果我的代码有错误,请告诉我!!
这是我的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

基本上,您必须在要用作编辑选项的编辑器属性中设置适当的表单字段。

最新更新