MODx.grid.TemplateTV=function(A){A=A||{};var B=new Ext.ux.grid.CheckColumn({header:_("access"),dataIndex:"access",width:70,sortable:false});Ext.applyIf(A,{title:_("template_assignedtv_tab"),id:"modx-grid-template-tv",url:MODx.config.connectors_url+"element/template/tv.php",fields:["id","name","description","tv_rank","access","category_name","category"],baseParams:{action:"getList",template:A.template},saveParams:{template:A.template},width:800,paging:true,plugins:B,remoteSort:true,columns:[{header:_("name"),dataIndex:"name",width:150,editor:{xtype:"textfield",allowBlank:false},sortable:true},{header:_("category"),dataIndex:"category_name",width:150,sortable:true},{header:_("description"),dataIndex:"description",width:350,editor:{xtype:"textfield"},sortable:false},B,{header:_("rank"),dataIndex:"tv_rank",width:100,editor:{xtype:"textfield",allowBlank:false},sortable:true}],tbar:["->",{xtype:"modx-combo-category",name:"filter_category",hiddenName:"filter_category",id:"modx-temptv-filter-category",emptyText:_("filter_by_category"),value:"",allowBlank:true,width:150,listeners:{select:{fn:this.filterByCategory,scope:this}}},"-",{xtype:"textfield",name:"search",id:"modx-temptv-search",emptyText:_("search_ellipsis"),listeners:{change:{fn:this.search,scope:this},render:{fn:function(C){new Ext.KeyMap(C.getEl(),{key:Ext.EventObject.ENTER,fn:function(){this.fireEvent("change",this.getValue());this.blur();return true;},scope:C});},scope:this}}},{xtype:"button",id:"modx-filter-clear",text:_("filter_clear"),listeners:{click:{fn:this.clearFilter,scope:this}}}]});MODx.grid.TemplateTV.superclass.constructor.call(this,A);};Ext.extend(MODx.grid.TemplateTV,MODx.grid.Grid,{filterByCategory:function(A,C,B){this.getStore().baseParams.category=A.getValue();this.getBottomToolbar().changePage(1);this.refresh();},search:function(D,C,B){var A=C||D;this.getStore().baseParams.search=Ext.isEmpty(A)||Ext.isObject(A)?"":A;Ext.getCmp("modx-temptv-filter-category").setValue("");this.getBottomToolbar().changePage(1);this.refresh();return true;},clearFilter:function(){this.getStore().baseParams={action:"getList"};Ext.getCmp("modx-temptv-filter-category").reset();Ext.getCmp("modx-temptv-search").setValue("");this.getBottomToolbar().changePage(1);this.refresh();}});Ext.reg("modx-grid-template-tv",MODx.grid.TemplateTV);