{ "id": "roo-file-89", "name": "Pman.Tab.CmsProduct", "parent": "Pman.Tab.CmsProductMgr", "title": "Pman.Tab.CmsProduct", "path": "/home/alan/gitlive/Pman.Cms/Pman.Tab.CmsProduct.bjs", "items": [ { "|xns": "Roo", "xtype": "GridPanel", "title": "Product", "fitToframe": true, "fitContainer": true, "tableName": "Product", "background": true, "region": "center", "listeners": { "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" }, "items": [ { "listeners": { "|render": "function() \n{\n _this.grid = this; \n _this.dialog = Pman.Dialog.CmsProduct;\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": "description", "ddGroup": "products", "enableDrag": true, "loadMask": true, "xtype": "Grid", "|xns": "Roo.grid", "items": [ { "listeners": { "beforeload": "function (_self, options)\n{\n if (!Pman.Tab.CmsProductCategory.panel) {\n return false;\n }\n options.params['query[search]'] = _this.searchBox.getValue();\n // category..\n var sn = Pman.Tab.CmsProductCategory.panel.tree.getSelectionModel().getSelectedNode();\n if (sn && !isNaN(parseInt(sn.attributes.id))) {\n options.params.category_id = sn.attributes.id;\n }\n \n}" }, "*prop": "dataSource", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ field : 'name', direction: 'ASC' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "xtype": "HttpProxy", "method": "GET", "|url": "baseURL + '/Roo/Product.php'", "|xns": "Roo.data" }, { "|xns": "Roo.data", "xtype": "JsonReader", "totalProperty": "total", "root": "data", "*prop": "reader", "id": "id", "|fields": "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'name',\n 'type': 'string'\n },\n {\n 'name': 'sku',\n 'type': 'string'\n },\n {\n 'name': 'price',\n 'type': 'float'\n },\n {\n 'name': 'shortdesc',\n 'type': 'string'\n },\n {\n 'name': 'description',\n 'type': 'string'\n },\n {\n 'name': 'visible',\n 'type': 'int'\n },\n {\n 'name': 'itemtypes',\n 'type': 'string'\n },\n {\n 'name': 'category_id',\n 'type': 'int'\n },\n {\n 'name': 'currency',\n 'type': 'string'\n },\n {\n 'name': 'vender_url',\n 'type': 'string'\n },\n {\n 'name': 'supplier_id',\n 'type': 'int'\n }\n]" } ] }, { "*prop": "footer", "xtype": "PagingToolbar", "pageSize": 25, "displayInfo": true, "displayMsg": "Displaying Product{0} - {1} of {2}", "emptyMsg": "No Product found", "|xns": "Roo" }, { "*prop": "toolbar", "xtype": "Toolbar", "|xns": "Roo", "items": [ { "listeners": { "render": "function (_self)\n{\n _this.searchBox = _self;\n}", "specialkey": "function (_self, e)\n{\n if (e.getKey() == 13) {\n _this.grid.footer.onClick( 'first' );\n }\n}" }, "xtype": "TextField", "|xns": "Roo.form" }, { "listeners": { "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}" }, "cls": "x-btn-icon", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/search.gif'", "|xns": "Roo.Toolbar" }, { "listeners": { "|click": "function (_self, e)\n{\n_this.searchBox.setValue('');\n _this.grid.footer.onClick('first');\n}" }, "cls": "x-btn-icon", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'", "|xns": "Roo.Toolbar" }, { "|xns": "Roo.Toolbar", "xtype": "Fill" }, { "listeners": { "|click": "function()\n{\n if (!_this.dialog) return;\n \n var sel = Pman.Tab.CmsProductCategory.panel.tree.getSelectionModel().getSelectedNode();\n var id = (!sel || isNaN(parseInt(sel.attributes.id))) ? 0 : sel.attributes.id;\n if (!id) {\n Roo.MessageBox.alert(\"Error\", \"Select a Category to add it to\");\n return;\n }\n\n \n _this.dialog.show( { id : 0, category_id :id } , function(data) {\n _this.searchBox.setValue(data.name);\n _this.grid.footer.onClick('first');\n }); \n}\n" }, "cls": "x-btn-text-icon", "text": "Add", "xtype": "Button", "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'", "|xns": "Roo.Toolbar" }, { "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" }, { "text": "Delete", "cls": "x-btn-text-icon", "|icon": "rootURL + '/Pman/templates/images/trash.gif'", "xtype": "Button", "listeners": { "|click": "function()\n{\n Pman.genericDelete(_this, 'Product'); \n}\n " }, "|xns": "Roo.Toolbar" } ] }, { "*prop": "colModel[]", "dataIndex": "id", "header": "Photo", "width": 100, "xtype": "ColumnModel", "|renderer": "function(v,x,r) {\n if (!r.json.images.length) {\n return '';\n }\n \n return String.format('',\n baseURL , r.json.images[0].id,r.json.images[0].filename ); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "category_id_title", "header": "Category", "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid", "sortable": true, "listeners": {} }, { "*prop": "colModel[]", "dataIndex": "name", "header": "Name", "sortable": true, "width": 200, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "sku", "header": "Sku", "width": 200, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid", "sortable": true, "listeners": {} }, { "*prop": "colModel[]", "dataIndex": "description", "header": "Description", "sortable": true, "width": 200, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" }, { "*prop": "colModel[]", "dataIndex": "visible", "header": "Visible", "sortable": true, "width": 75, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid" } ] } ] } ], "permname": "Cms.Products" }