Trenutno mi problem pravi to sto nemogu da pogodim kako treba da izgleda [data] promenljiva kako bih popunio combo, i to sto kad dodam podatke kao
Code:
store: [['f2','Foo2'],['b2','Bar2']]
store: [['f2','Foo2'],['b2','Bar2']]
nakom prvog izbora neke od opcija ostale nestanu i nemogu da promenim izbor. :-((
Code:
// home.panel.js
...
{
title: 'Send newsletter'
,defaults: { autoHeight: true }
,items: [{
xtype: 'ditsnews-panel-send'
,preventRender: true
}]
,listeners: {
activate: {
fn: function() {
MODx.Ajax.request({
scope: this,
url: Ditsnews.config.connectorUrl,
params: {
action: 'mgr/send/get'
}
,listeners: {
success: {fn:function(reply) {
var sendConfig = reply;
console.log('send-init');
// console.dir(reply); // send tab
sendConfig = sendConfig.object;
data = 'kako treba da bude formirana ova promenljiva';
Ext.getCmp('ditsnews-panel-send').getForm().setValues(data);
}, scope:this}
}
}); // end ajax
}
}
}
}
...
// home.panel.js
...
{
title: 'Send newsletter'
,defaults: { autoHeight: true }
,items: [{
xtype: 'ditsnews-panel-send'
,preventRender: true
}]
,listeners: {
activate: {
fn: function() {
MODx.Ajax.request({
scope: this,
url: Ditsnews.config.connectorUrl,
params: {
action: 'mgr/send/get'
}
,listeners: {
success: {fn:function(reply) {
var sendConfig = reply;
console.log('send-init');
// console.dir(reply); // send tab
sendConfig = sendConfig.object;
data = 'kako treba da bude formirana ova promenljiva';
Ext.getCmp('ditsnews-panel-send').getForm().setValues(data);
}, scope:this}
}
}); // end ajax
}
}
}
}
...
Code:
// send.panel.js
Ditsnews.panel.Send = function(config) {
config = config || {};
Ext.applyIf(config,{
id: 'ditsnews-panel-send'
,layout: 'form'
,url: Ditsnews.config.connectorUrl
,baseCls: 'modx-formpanel'
,baseParams: { action: 'mgr/send/get' }
,buttonAlign: 'left'
,buttons: [{
text: 'Send',
scope: this,
handler: function() {
var postData = {
formData: Ext.encode(this.getForm().getFieldValues()),
action: 'mgr/send/email'
}
MODx.Ajax.request({
url: Ditsnews.config.connectorUrl
,params: postData
,scope: this,
listeners: {
success: {fn:function(response) {
var status = response;
console.log('send-ajax');
// console.dir(response); // send
if(status.success == true) {
MODx.msg.status({title: 'Newsletter has been sent'});
// TREBA IZBACITI TRENUTNO IZABRANU STAVKU !!!
} else {
MODx.msg.status({title: 'Newsletter was not sent!'});
}
}
}
}
});
}
}] // end buttons:
,items: [{
layout: 'form'
,items: [
{
xtype: 'combo',
name: 'newsletter_id',
fieldLabel: 'Newsletter ID:',
allowBlank: false,
forceSelection: true,
editable: false,
emptyText: 'Choose newsletter...',
// OVO PUNI COMBO ALI PO IZBORU JEDNE STAVKE VISE NEMOGU DA PROMENIM IZBOR
store: [['f2','Foo2'],['b2','Bar2']]
}
]
}]
,border: false
});
Ditsnews.panel.Send.superclass.constructor.call(this,config);
};
// send.panel.js
Ditsnews.panel.Send = function(config) {
config = config || {};
Ext.applyIf(config,{
id: 'ditsnews-panel-send'
,layout: 'form'
,url: Ditsnews.config.connectorUrl
,baseCls: 'modx-formpanel'
,baseParams: { action: 'mgr/send/get' }
,buttonAlign: 'left'
,buttons: [{
text: 'Send',
scope: this,
handler: function() {
var postData = {
formData: Ext.encode(this.getForm().getFieldValues()),
action: 'mgr/send/email'
}
MODx.Ajax.request({
url: Ditsnews.config.connectorUrl
,params: postData
,scope: this,
listeners: {
success: {fn:function(response) {
var status = response;
console.log('send-ajax');
// console.dir(response); // send
if(status.success == true) {
MODx.msg.status({title: 'Newsletter has been sent'});
// TREBA IZBACITI TRENUTNO IZABRANU STAVKU !!!
} else {
MODx.msg.status({title: 'Newsletter was not sent!'});
}
}
}
}
});
}
}] // end buttons:
,items: [{
layout: 'form'
,items: [
{
xtype: 'combo',
name: 'newsletter_id',
fieldLabel: 'Newsletter ID:',
allowBlank: false,
forceSelection: true,
editable: false,
emptyText: 'Choose newsletter...',
// OVO PUNI COMBO ALI PO IZBORU JEDNE STAVKE VISE NEMOGU DA PROMENIM IZBOR
store: [['f2','Foo2'],['b2','Bar2']]
}
]
}]
,border: false
});
Ditsnews.panel.Send.superclass.constructor.call(this,config);
};
I na kraju treba izbaciti trenutno izabranu stavku.
Svaka pomoc je dobrodosla!