closable : false,
collapsible : false,
height : 380,
+ modal : true,
resizable : false,
title : "Edit / Create Product",
width : 700,
actioncomplete : function(_self,action)
{
if (action.type == 'setdata') {
- _this.dialog.el.mask("Loading");
+
if (_this.data.id) {
_this.dialog.el.mask("Loading");
this.load({ method: 'GET', params: { '_id' : _this.data.id }});
if (action.type =='submit') {
_this.dialog.el.unmask();
- _this.dialog.hide();
-
+
+ _this.data.id = action.result.data.id;
+ _this.form.findField('id').setValue(_this.data.id);
if (_this.callback) {
- _this.callback.call(_this, _this.form.getValues());
+ var res = _this.callback.call(_this, _this.form.getValues());
+ if (res === false) {
+ return;
+ }
}
+ _this.dialog.hide();
_this.form.reset();
return;
}
}
]
},
+ {
+ xtype: 'Hidden',
+ xns: Roo.form,
+ name : 'category_id'
+ },
{
xtype: 'Hidden',
xns: Roo.form,
return;
}
_this.hasUploadWatch =true;
- _this.uploadSending =false;
- window.setInterval( function() {
+ _this.uploadSending =false;
+ window.setInterval( function()
+ {
var val = _this.uploadForm.findField('imageUpload').getValue();
if (!val || !val.length) {
return;
if (_this.uploadSending) {
return;
}
+
+ if (!_this.data.id) {
+ // trigger a save..
+ var cb = _this.callback;
+ _this.callback = function() {
+ _this.uploadSending = false;
+ _this.callback = cb;
+ return false;
+ }
+ _this.uploadSending = true;
+ _this.form.doAction("submit");
+ return;
+ }
+
_this.uploadSending =true;
_this.uploadForm.findField('onid').setValue(_this.data.id);
_this.uploadForm.el.mask("Sending");
jsonRoot : 'data',
singleSelect : true,
loadImages : function() {
- if (!_this.data.id) {return; }
+ if (!_this.data.id) {
+ this.clearSelections();
+ this.el.update("");
+ this.jsonData = [];
+ return;
+ }
this.load({
url : baseURL + '/Roo/Images.php',
method : 'GET',
success : function() {
_this.imageView.el.unmask();
- _this.imageView.loadImages()
+ _this.imageView.loadImages();
},
failure : function() {
_this.imageView.el.unmask();