sm : {
xtype: 'RowSelectionModel',
xns: Roo.grid,
- singleSelect : true
+ singleSelect : false
},
dataSource : {
xtype: 'Store',
{
o.params._with_prodcat = 1;
o.params._with_char = 1;
- o.params._with_itemsrc_active = 1;
+ if (!_this.data.exclude_itemsrc_vendor) {
+
+ o.params._with_itemsrc_active = 1;
+ }
o.params._with_last_purchase_price = 1;
- o.params._with_image = 1;
o.params._with_itemsite = 1;
- o.params.cohead_cust_id = _this.data.cohead_cust_id;
- o.params.cohead_id = _this.data.cohead_id;
+ o.params._with_image = 1;
+
+ if(typeof(_this.data.cohead_cust_id) != 'undefined'){
+ o.params.cohead_cust_id = _this.data.cohead_cust_id;
+ }
+
+ if(typeof(_this.data.cohead_id) != 'undefined'){
+ o.params.cohead_id = _this.data.cohead_id;
+ }
+
var s = _this.searchBox.getValue();
- if (!s.length) {
- return false;
- }
- o.params['query[number_or_name]'] = s;
+ if (s.length) {
+ o.params['query[number_or_name]'] = s;
+ }
+ if (_this.data.exclude_itemsrc_vendor) {
+ o.params._exclude_itemsrc_vendor = _this.data.exclude_itemsrc_vendor;
+ }
+
+ _this.addSelected.show();
+ if (!_this.data.multi_select) {
+ _this.addSelected.hide();
+ }
}
},
listeners : {
click : function (_self, e)
{
- _this.searchBox.setValue('');
- _this.status_type.setValue('');
- _this.grid.footer.onClick('first');
+ _this.searchBox.setValue('');\r
+ _this.status_type.setValue('');\r
+ _this.grid.footer.onClick('first');\r
}
},
cls : 'x-btn-icon',
{
xtype: 'ColumnModel',
xns: Roo.grid,
- dataIndex : 'item_image_filename',
+ dataIndex : 'item_image_id',
header : 'Image',
- width : 150,
- renderer : function(v,x,r)
- {
- if(!v){
- return '';
- }
- if(r.data.item_image_from_hk){
- var url = baseURL.split('/');
- url.pop();
- url = url.join('/');
- return '<img src="' + url + '/hk.php/Images/Thumb/150x150/' + r.data.item_image_id + '/' + v + '" width="150" height="100" />';
- }
- return '<img src="' + baseURL + '/Images/Thumb/150x150/' + r.data.item_image_id + '/' + v + '" width="150" height="100" />';
- }
+ width : 100,
+ renderer : function(v,x,r) { return String.format('<img src="{0}/Images/Thumb/50/{1}/{2}" height="50">', baseURL, v, r.data.item_image_filename); }
},
{
xtype: 'ColumnModel',
xns: Roo
},
buttons : [
+ {
+ xtype: 'Button',
+ xns: Roo,
+ listeners : {
+ click : function (_self, e)
+ {
+
+ if(!_this.callback){
+ _this.dialog.hide();
+ return;
+ }
+ var sels = _this.grid.selModel.getSelections();
+ if (!sels.length) {
+ Roo.MessageBox.alert("Error", "Select some items");
+ }
+ _this.dialog.hide();
+ _this.callback.call(_this,sels);
+ },
+ render : function (_self)
+ {
+ _this.addSelected = _self;
+ }
+ },
+ text : "Add Selected"
+ },
+ {
+ xtype: 'Button',
+ xns: Roo,
+ listeners : {
+ click : function (_self, e)
+ {
+ Pman.Dialog.XtupleItem.show({item_id : 0}, function(){
+ _this.grid.footer.onClick('first');
+ });
+ }
+ },
+ text : "Create New"
+ },
{
xtype: 'Button',
xns: Roo,