[CLOSED] Way to tell store to reaload data but only if circumstances are met

Page 3 of 5 FirstFirst 12345 LastLast
  1. #21
    Last edited by ViDom; Dec 14, 2012 at 9:33 AM.
  2. #22
    I see you have an access to the ComboBox in the Button's Click DirectEvent hanlder.

    So you can generate JavaScript in this handler and pass it to a client to execute this way:
    X.Js.AddScript("script");
    Or define a JavaScript function and call it this way:
    X.Js.Call("reloadComboBoxAndSetValue", combo.ClientID, "value");
  3. #23
    Quote Originally Posted by Daniil View Post
    I see you have an access to the ComboBox in the Button's Click DirectEvent hanlder.

    So you can generate JavaScript in this handler and pass it to a client to execute this way:
    X.Js.AddScript("script");
    Or define a JavaScript function and call it this way:
    X.Js.Call("reloadComboBoxAndSetValue", combo.ClientID, "value");
    What do you mean i can pass Javascript to client?
    Do you mean that i can pass some javascript to iframe this way?

    Could you provide sample where should I do it?
    Last edited by ViDom; Dec 13, 2012 at 6:12 PM.
  4. #24
    Hello!

    I think @Daniil wants to say that you can combine server data with JS function.
    For example, you have following JS function which reloads store and sets ComboBox's value:

    var reloadComboBoxAndSetValue = function() {
    	var combo = parent.ComboBox1;
    	 
    	combo.getStore().reload({
    		callback: function () {
    			combo.setValue('value');
    		}
    	});
    }
    And then instead of this Server code:

    Store store = this.ComboBox1.GetStore();
    store.AddListener("load", string.Format("function () {{ {0}.setValue('{1}'); }}", this.ComboBox1.ClientID, "value"), null, new HandlerConfig() { Single = true });
    store.Call("reload");
    You can call your JS function from Server side in this way:

    X.Js.Call("reloadComboBoxAndSetValue", combo.ClientID, "value");
  5. #25
    Quote Originally Posted by Baidaly View Post
    Hello!

    I think @Daniil wants to say that you can combine server data with JS function.
    For example, you have following JS function which reloads store and sets ComboBox's value:

    var reloadComboBoxAndSetValue = function() {
    	var combo = parent.ComboBox1;
    	 
    	combo.getStore().reload({
    		callback: function () {
    			combo.setValue('value');
    		}
    	});
    }
    And then instead of this Server code:



    You can call your JS function from Server side in this way:

    X.Js.Call("reloadComboBoxAndSetValue", combo.ClientID, "value");
    Could you please specify where should I do this exactly? my understanding of integrating javascript and server control is really low:(

    need I use:
    X.Js.Call("reloadComboBoxAndSetValue", combo.ClientID, "value");
    on button inside iframe? And this Js function should be added in my serverControl prerender event or where?
    Last edited by ViDom; Dec 14, 2012 at 9:21 AM.
  6. #26
    In your case it would be easy to use:
    X.Js.AddScript("script");
    And yes, you should call it from the Button's Click DirectEvent handler.
  7. #27
    Quote Originally Posted by Daniil View Post
    In your case it would be easy to use:
    X.Js.AddScript("script");
    And yes, you should call it from the Button's Click DirectEvent handler.
    ok but I still can't understand how script will know what value set in my combobox after I add some in iframe?

    I'm a really beginer in Ext Js so such a script will be at level extra hard i assumed for me :(
  8. #28
    Quote Originally Posted by ViDom View Post
    ok but I still can't understand how script will know what value set in my combobox after I add some in iframe?
    Where does you add a new item from the iframe in your sample?
  9. #29
    Quote Originally Posted by Daniil View Post
    Where does you add a new item from the iframe in your sample?
    yes I adding my new item inside iframe of window. I though I make it clear at begin of this thread...
  10. #30
    Please post a piece of code where you do that.
Page 3 of 5 FirstFirst 12345 LastLast

Similar Threads

  1. Replies: 0
    Last Post: Apr 22, 2012, 9:39 AM
  2. Replies: 1
    Last Post: Mar 08, 2012, 2:52 PM
  3. Replies: 5
    Last Post: May 17, 2011, 9:10 AM
  4. Replies: 5
    Last Post: Nov 26, 2010, 5:39 PM
  5. [CLOSED] Data Store deriving invalid data variable name
    By SFritsche in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 15, 2009, 12:31 PM

Tags for this Thread

Posting Permissions