[ 357_97 @ 13.12.2011. 23:38 ] @
Radim u nekom CMS-u koji koristi Ext JS pa se javilo par problema. Na strani imam jedan panel (tab) u kome je forma sa combo box-om i dugmetom za slanje forme. Ja treba da nakon klika na taj tab napunim podacima taj combo i da nakon slanja forme, ako je ono bilo uspesno, iz comb box-a uklonim tu vrednost. U pitanju je neka newsletter skripta, tako da ako je mail uspesno poslat, taj newsletter id brisem. 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']] 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 } } } } ... 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); }; I na kraju treba izbaciti trenutno izabranu stavku. Svaka pomoc je dobrodosla! |