- },
- '|xns' : 'Roo.data',
- remoteSort : true,
- sortInfo : { field : 'itemsrc_vend_id_vend_name', direction: 'ASC' },
- xns : Roo.data,
- xtype : 'Store',
- listeners : {
- beforeload : function (_self, o)
- {
-
- var id = 1 * _this.form.findField('item_id').getValue();
- if (!id) {
- this.removeAll();
- return false;
- }
- o.params.itemsrc_item_id = id;
- },
- update : function (_self, record, operation)
- {
- Roo.log(operation);
- Roo.log(record);
-
- if (operation != 'commit') {
- return;
- }
- if (record.data.itemsrc_vend_id * 1 < 1) {
- return; // do not save.
- }
- if (record.data.itemsrc_id * 1 < 0) {
- return; // do not save. -- updating at present...
- }
-
- var p = Roo.apply({}, record.data);
- record.set('itemsrc_id', -1);
-
- new Pman.Request({
- url : baseURL + '/Roo/Itemsrc',
- params : p,
- method : 'POST',
- success: function(res) {
- if (record.data.itemsrc_id *1 < 1) {
- record.set('itemsrc_id', res.data.itemsrc_id);
- }
- }
- });
-
-
- }
- },
- items : [
-
- ]
-
- },
- footer : {
- '|xns' : 'Roo',
- displayInfo : true,
- displayMsg : _this._strings['7f841b4d2f7280eb82318988c6d649d1'],
- emptyMsg : _this._strings['19df363d15888baa395364fbcd230c05'],
- pageSize : 25,
- xns : Roo,
- xtype : 'PagingToolbar'
- },
- toolbar : {
- '|xns' : 'Roo',
- xns : Roo,
- xtype : 'Toolbar',
- items : [
- {
- '|xns' : 'Roo.Toolbar',
- cls : 'x-btn-text-icon',
- icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
- text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'],
- xns : Roo.Toolbar,
- xtype : 'Button',
- listeners : {
- click : function()
- {
-
- Roo.log("add presed");
-
- // work out last
- var grid = _this.itemsrcgrid;
-
- // uses form defaults or last row value.
- var nr = grid.ds.reader.newRow({
- itemsrc_id : 0,
- itemsrc_item_id : _this.form.findField('item_id').getValue(),
- itemsrc_vend_id : 0,
- itemsrc_vend_id_vend_name : '',
- itemsrc_vend_item_number : '',
- itemsrc_vend_item_descrip : '',
- itemsrc_comments : '',
- itemsrc_vend_uom : 'EA',
- itemsrc_invvendoruomratio : 1.0,
- itemsrc_minordqty : 0,
- itemsrc_multordqty : 0,
- itemsrc_leadtime : 30,
- itemsrc_ranking : 0,
- itemsrc_active : true,
- itemsrc_manuf_name : '',
- itemsrc_manuf_item_number : '',
- itemsrc_manuf_item_descrip: '',
- itemsrc_default : true,
- itemsrc_upccode : ''
-
- });
- grid.stopEditing();
- grid.ds.insert(0, nr);
- grid.startEditing(0, 0); // type..
-
- }
- }
- }
- ]
-