"background": true,
"fitContainer": true,
"fitToframe": true,
- "region": "center",
+ "region": "south",
"tableName": "Office",
"title": "Offices / Departments / Sub-Companies",
"xtype": "GridPanel",
"|xns": "Roo",
"items": [
{
- "*prop": "grid",
- "xtype": "Grid",
- "autoExpandColumn": "name",
- "loadMask": true,
"listeners": {
- "|render": "function() \n{\n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}",
+ "|render": "function() \n{\n _this.grid = this; \n _this.dialog =Pman.Dialog.Office;\n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}",
"|rowdblclick": "function (_self, rowIndex, e)\n{\n if (!_this.dialog) return;\n _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n _this.grid.footer.onClick('first');\n }); \n}\n"
},
+ "*prop": "grid",
+ "autoExpandColumn": "name",
+ "loadMask": true,
+ "xtype": "Grid",
"|xns": "Roo.grid",
"items": [
{
+ "listeners": {
+ "beforeload": "function (_self, o)\n{\n try {\n var sm = Pman.Tab.AdminCompanies.grid.getSelectionModel();\n sm = sm.getSelected();\n if (!sm || !sm.data.id) {\n // mask??\n return false;\n }\n \n o.params.company_id = sm.data.id ;\n } catch (e) {\n return false;\n }\n \n }"
+ },
"*prop": "dataSource",
- "xtype": "Store",
"remoteSort": true,
+ "xtype": "Store",
"|sortInfo": "{ field : 'name', direction: 'ASC' }",
"|xns": "Roo.data",
"items": [
"|xns": "Roo",
"items": [
{
+ "listeners": {
+ "|click": "function()\n{\n if (!_this.dialog) return;\n \n var cdata = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data;\n _dialog.show( { \n id : 0 ,\n company_name : cdata.name,\n company_id : cdata.id,\n address : cdata.address,\n phone : cdata.tel,\n fax : cdata.fax,\n email : cdata.email\n } , function() {\n _this.grid.footer.onClick('first');\n });\n}\n"
+ },
+ "cls": "x-btn-text-icon",
"text": "Add",
"xtype": "Button",
- "cls": "x-btn-text-icon",
"|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
- "listeners": {
- "|click": "function()\n{\n if (!_this.dialog) return;\n _this.dialog.show( { id : 0 } , function() {\n _this.grid.footer.onClick('first');\n }); \n}\n"
- },
"|xns": "Roo.Toolbar"
},
{
+ "listeners": {
+ "|click": "function()\n{\n var s = _this.grid.getSelectionModel().getSelections();\n if (!s.length || (s.length > 1)) {\n Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n return;\n }\n if (!_this.dialog) return;\n s[0].data.company_name = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data.name;\n _this.dialog.show(s[0].data, function() {\n _this.grid.footer.onClick('first');\n }); \n \n}\n"
+ },
+ "cls": "x-btn-text-icon",
"text": "Edit",
"xtype": "Button",
- "cls": "x-btn-text-icon",
"|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
- "listeners": {
- "|click": "function()\n{\n var s = _this.grid.getSelectionModel().getSelections();\n if (!s.length || (s.length > 1)) {\n Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n return;\n }\n if (!_this.dialog) return;\n _this.dialog.show(s[0].data, function() {\n _this.grid.footer.onClick('first');\n }); \n \n}\n"
- },
"|xns": "Roo.Toolbar"
},
{
]
},
{
- "xtype": "ColumnModel",
- "header": "Id",
- "width": 75,
- "dataIndex": "id",
- "|renderer": "function(v) { return String.format('{0}', v); }",
- "|xns": "Roo.grid",
- "*prop": "colModel[]"
- },
- {
- "xtype": "ColumnModel",
- "header": "Company",
- "width": 75,
- "dataIndex": "company_id",
- "|renderer": "function(v) { return String.format('{0}', v); }",
- "|xns": "Roo.grid",
- "*prop": "colModel[]"
- },
- {
- "xtype": "ColumnModel",
- "header": "Name",
- "width": 200,
+ "*prop": "colModel[]",
"dataIndex": "name",
- "|renderer": "function(v) { return String.format('{0}', v); }",
- "|xns": "Roo.grid",
- "*prop": "colModel[]"
- },
- {
- "xtype": "ColumnModel",
- "header": "Address",
+ "header": "Name / Department / Sub Comp.",
+ "sortable": true,
"width": 200,
- "dataIndex": "address",
+ "xtype": "ColumnModel",
"|renderer": "function(v) { return String.format('{0}', v); }",
- "|xns": "Roo.grid",
- "*prop": "colModel[]"
+ "|xns": "Roo.grid"
},
{
- "xtype": "ColumnModel",
- "header": "Phone",
- "width": 200,
+ "*prop": "colModel[]",
"dataIndex": "phone",
+ "header": "Phone",
+ "width": 100,
+ "xtype": "ColumnModel",
"|renderer": "function(v) { return String.format('{0}', v); }",
- "|xns": "Roo.grid",
- "*prop": "colModel[]"
+ "|xns": "Roo.grid"
},
{
- "xtype": "ColumnModel",
- "header": "Fax",
- "width": 200,
+ "*prop": "colModel[]",
"dataIndex": "fax",
+ "header": "Fax",
+ "width": 100,
+ "xtype": "ColumnModel",
"|renderer": "function(v) { return String.format('{0}', v); }",
- "|xns": "Roo.grid",
- "*prop": "colModel[]"
+ "|xns": "Roo.grid"
},
{
- "xtype": "ColumnModel",
+ "*prop": "colModel[]",
+ "dataIndex": "email",
"header": "Email",
"width": 200,
- "dataIndex": "email",
- "|renderer": "function(v) { return String.format('{0}', v); }",
- "|xns": "Roo.grid",
- "*prop": "colModel[]"
+ "xtype": "ColumnModel",
+ "|renderer": "function (v) {\n return (v.length && v.indexOf('@') > 0 ) ? \n String.format('<a href=\"mailto:{0}\">{0}</a>',v) : v;\n \n}",
+ "|xns": "Roo.grid"
},
{
+ "*prop": "colModel[]",
+ "dataIndex": "address",
+ "header": "Address",
+ "width": 300,
"xtype": "ColumnModel",
- "header": "Role",
- "width": 200,
- "dataIndex": "role",
"|renderer": "function(v) { return String.format('{0}', v); }",
- "|xns": "Roo.grid",
- "*prop": "colModel[]"
+ "|xns": "Roo.grid"
}
]
}