MODx.grid.LocalProperty=function(A){A=A||{};Ext.applyIf(A,{dynProperty:"xtype",dynField:"value",propertyRecord:[{name:"name"},{name:"value"}],data:[]});MODx.grid.LocalProperty.superclass.constructor.call(this,A);this.propRecord=Ext.data.Record.create(A.propertyRecord);};Ext.extend(MODx.grid.LocalProperty,MODx.grid.LocalGrid,{onCellDblClick:function(E,B,C,F){var A=this.getColumnModel();if(A.getColumnId(C)!=this.config.dynField){this.onCellDblClick(E,B,C,F);}else{F.preventDefault();var D=this.getStore().getAt(B).data;this.initEditor(A,C,B,D);this.startEditing(B,C);}},initEditor:function(A,D,B,E){A.setEditable(D,true);var H=this.config.dynProperty;if(E[H]=="list"){var G=this.createCombo(E);}else{var F={};F[H]=E[H]||"textfield";var G=Ext.ComponentMgr.create(F);}var C=new Ext.grid.GridEditor(G);A.setEditor(D,C);return C;},renderDynField:function(L,I,E,J,N,M,G){var A=M.getAt(J).data;var H;var B=L;var C=this.config.dynProperty;if(!A[C]||A[C]=="combo-boolean"){H=MODx.grid.Grid.prototype.rendYesNo;B=H(L==1,I);}else{if(A[C]==="datefield"){H=Ext.util.Format.dateRenderer("Y-m-d");B=H(L);}else{if(A[C].substr(0,5)=="combo"||A[C]=="list"||A[C].substr(0,9)=="modx-combo"){var K=G.getColumnModel();var F=K.getCellEditor(N,J);var D;if(!F){A.xtype=A.xtype||"combo-boolean";D=this.createCombo(A);F=new Ext.grid.GridEditor(D);K.setEditor(N,F);}else{if(F&&F.field&&F.field.xtype=="modx-combo"){D=F.field;}}if(A[C]!="list"){H=MODx.combo.Renderer(F.field);B=H(L);}else{if(D){idx=D.getStore().find(D.valueField,L);E=D.getStore().getAt(idx);if(E){B=E.get(D.displayField);}else{B=L;}}}}}}return Ext.util.Format.htmlEncode(B);},createCombo:function(G){var F;try{F=Ext.ComponentMgr.create({xtype:r.xtype,id:Ext.id()});}catch(E){try{var B=G.options;var C=[];for(var A=0;A<B.length;A=A+1){C.push([B[A].name,B[A].value,B[A].text]);}F=MODx.load({xtype:"modx-combo",store:new Ext.data.SimpleStore({fields:["d","v","t"],data:C}),displayField:"d",valueField:"v",mode:"local",triggerAction:"all",editable:false,selectOnFocus:false,preventRender:true});}catch(D){F=Ext.ComponentMgr.create({xtype:"combo-boolean",id:Ext.id()});}}return F;}});Ext.reg("grid-local-property",MODx.grid.LocalProperty);