{ "items" : [ { "$ xns" : "Roo", "autoScroll" : true, "bool background" : false, "fitContainer" : true, "fitToframe" : true, "items" : [ { "$ xns" : "Roo.grid", "* prop" : "grid", "autoExpandColumn" : "name", "ddGroup" : "groupDD", "enableDrag" : true, "items" : [ { "$ sortInfo" : "{ field : 'name', direction: 'ASC' }", "$ xns" : "Roo.data", "* prop" : "dataSource", "items" : [ { "$ url" : "baseURL + '/Roo/core_person'", "$ xns" : "Roo.data", "* prop" : "proxy", "method" : "GET", "xtype" : "HttpProxy" }, { "$ xns" : "Roo.data", "* prop" : "reader", "id" : "id", "root" : "data", "totalProperty" : "total", "xtype" : "JsonReader" } ], "listeners" : { "beforeload" : [ "function (_self, o)", "{", " if(!_this.active_company_button.pressed){", " o.params['!company_id_comptype'] = 'OWNER';", " }", " ", " o.params['query[search]'] = _this.searchBox.getValue();", " ", " if (!_this.activeButton) {return; false;}", " ", " if (_this.companyCombo && _this.companyCombo.getValue()) {", " o.params.company_id = _this.companyCombo.getValue();", " }", " ", " ", " o.params.active = _this.activeButton.pressed ? 0 : 1;", " ", " if(_this.active_company_button.pressed){", " o.params.company_id = 0;", " }", " ", " var c = Pman.Tab.AdminContactsManager.layout.getRegion('west').getActivePanel();", " ", " if (!c) { ", " return false;", " }", " ", " var tms = c.grid.getSelectionModel().getSelected();", " ", " if (!tms) {", " return false;", " }", " ", " if(c.tableName == 'Groups'){", " o.params['query[in_group]'] = tms.data.id;", " o.params['query[type]'] = 2; // group type..", " }else{", " o.params['query[in_country]'] = (tms.data.country*1 == -1) ? '' : tms.data.country;", " o.params['query[in_group]'] = 0;", " o.params['query[type]'] = 2;", " }", " /*", " if (Pman.Tab.AdminContactsGroup && Pman.Tab.AdminContactsGroup.grid) {", " ", " ", " ", " }", " ", " if(Pman.Tab.AdminCountries && Pman.Tab.AdminCountries.grid){", " var tms = Pman.Tab.AdminCountries.grid.getSelectionModel().getSelected();", " ", " if (!tms) {", " return false;", " }", " ", " }", " */", " //o.params['query[name]'] = _this.searchBox.getValue();", " ", "}" ], "update" : [ "function (_self, record, operation)", "{", " if (operation != 'commit') {", " return;", " }", " // only used to change active status.", " ", " new Pman.Request({", " url : baseURL + '/Roo/Person.php',", " method :'POST',", " params : {", " id : record.data.id,", " active: record.data.active", " ", " },", " success : function() {", " // do nothing", " ", " _this.grid.ds.remove(record);", " ", " },", " failure : function() ", " {", " Roo.MessageBox.alert(\"Error\", \"saving failed\", function() {", " _this.grid.footer.onClick('first');", " });", " }", " });", "}" ] }, "remoteSort" : true, "xtype" : "Store" }, { "$ xns" : "Roo", "* prop" : "footer", "displayInfo" : true, "displayMsg" : "Displaying Person{0} - {1} of {2}", "emptyMsg" : "No Person found", "items" : [ { "$ xns" : "Roo.Toolbar", "text" : "Drag person to add or remove from group", "xtype" : "TextItem" } ], "pageSize" : 25, "xtype" : "PagingToolbar" }, { "$ xns" : "Roo", "* prop" : "toolbar", "items" : [ { "$ xns" : "Roo.Toolbar", "text" : "Search", "xtype" : "TextItem" }, { "$ xns" : "Roo.form", "listeners" : { "render" : [ "function (_self)", "{", " _this.searchBox = _self;", "}" ], "show" : [ "function (_self,e)", "{", " if (e.getCharCode() != 13) {", " return;", " }", " _this.grid.footer.onClick('first');", "}" ], "specialkey" : [ "function (_self, e)", "{", " if (e.getKey() == 13) {", " _this.grid.footer.onClick('first');", " }", "}" ] }, "xtype" : "TextField" }, { "$ xns" : "Roo.form", "displayField" : "name", "editable" : true, "emptyText" : "Select Company", "forceSelection" : true, "hiddenName" : "company_id", "items" : [ { "$ sortInfo" : "{ direction : 'ASC', field: 'name' }", "$ xns" : "Roo.data", "* prop" : "store", "items" : [ { "$ url" : "baseURL + '/Roo/core_company'", "$ xns" : "Roo.data", "* prop" : "proxy", "method" : "GET", "xtype" : "HttpProxy" }, { "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"code\",\"type\":\"string\"}]", "$ xns" : "Roo.data", "* prop" : "reader", "id" : "id", "root" : "data", "totalProperty" : "total", "xtype" : "JsonReader" } ], "listeners" : { "|beforeload" : [ "function (_self, o){", " o.params = o.params || {};", " // set more here", "}", "" ] }, "remoteSort" : true, "xtype" : "Store" } ], "listWidth" : 400, "listeners" : { "render" : [ "function (_self)", "{", " _this.companyCombo = _self;", "}" ], "select" : [ "function (combo, record, index)", "{", " _this.grid.footer.onClick.defer(300,_this.grid.footer,[ 'first'] );", "}" ] }, "loadingText" : "Searching...", "minChars" : 2, "name" : "company_name", "pageSize" : 20, "qtip" : "Select Companies", "queryParam" : "query[name]", "selectOnFocus" : true, "tpl" : "