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

Page 2 of 5 FirstFirst 1234 ... LastLast
  1. #11
    Quote Originally Posted by Daniil View Post
    Please provide us with the Store's configuration. A solution can depend on it.
    I get it:)

    Here's my configuration for now:
    string DisplayField = "Name";
    string ValueField = "Id";
    string EmptyText = "-- empty --";
    string EmptyValue = 0;
    Ext.Net.ComboBox combo = new Ext.Net.ComboBox();
    Ext.Net.Store store = new Ext.Net.Store();
                    store.ID = this.ID + "_Store";
                    Ext.Net.JsonReader reader = new JsonReader();
                    combo.DisplayField = DisplayField;
                    combo.ValueField = ValueField;
                    combo.EmptyText = EmptyText;
                    combo.EmptyValue = EmptyValue;
                    reader.Fields.AddRange(new List<RecordField>{new RecordField(ValueField, RecordFieldType.Int), new RecordField(DisplayField, RecordFieldType.String)});
                    store.SortInfo.Direction = SortDirection.ASC;
                    store.SortInfo.Field = DisplayField;
                    store.Reader.Add(reader);
                    reader.IDProperty = ValueField;
                    Ext.Net.HttpProxy proxy = new Ext.Net.HttpProxy();
                    proxy.Url = "~/ComboHandler.cs";
                    proxy.Method = HttpMethod.POST;
                    proxy.Timeout = 10000;
                    store.Proxy.Add(proxy);
                    store.AutoLoad = false;
                    store.BaseParams["session_name_combobox"] = store.ID;
                    string jsonParams = JSON.Serialize(searchParams);
                    store.BaseParams[store.ID + "_searchparams"] = jsonParams;
                    combo.TriggerAction = TriggerAction.All;
    1 more issue happend how to load only 1 value to combobox on server side:
    object o = Activator.CreateInstance(type,new object[]{1,null};//type is System.Type of my BLL Object
    ((MMPControls.Web.ComboBoxWithAddFeature)control.Value).Store.AddRecord(o);//here I got exception JsonSerializationException do I need serialize this 'o' element?
    Last edited by ViDom; Dec 12, 2012 at 2:28 PM.
  2. #12
    Ok, thanks.

    I would try to call this code from a server just after adding a new item.
    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");
    Quote Originally Posted by ViDom View Post
    1 more issue happend how to load only 1 value to combobox on server side:
    object o = Activator.CreateInstance(type,new object[]{1,null};//type is System.Type of my BLL Object
    ((MMPControls.Web.ComboBoxWithAddFeature)control.Value).Store.AddRecord(o);//here I got exception JsonSerializationException do I need serialize this 'o' element?
    Please start a new forum thread.
  3. #13
    Quote Originally Posted by Daniil View Post
    Ok, thanks.

    I would try to call this code from a server just after adding a new item.
    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");


    Please start a new forum thread.
    but how to get this combobox from iframe page? it is on parent page of window but save is make in iframe mode inside this window:(
    Last edited by ViDom; Dec 12, 2012 at 9:17 PM.
  4. #14
    Yes, there is no way to access a parent page from an iframe in code behind.

    But, fortunately, you can use this JavaScript code on a client (within an iframe page) after adding a new item.

    var combo = parent.ComboBox1;
    
    combo.getStore().reload({
        callback: function () {
            combo.setValue('value');
        }
    });
  5. #15
    Quote Originally Posted by Daniil View Post
    Yes, there is no way to access a parent page from an iframe in code behind.

    But, fortunately, you can use this JavaScript code on a client (within an iframe page) after adding a new item.

    var combo = parent.ComboBox1;
    
    combo.getStore().reload({
        callback: function () {
            combo.setValue('value');
        }
    });
    var combo = parent.#{ComboBox1}
    is it correct?
  6. #16
    No, it won't work.

    #{} is actual on the page only where the control is presented.
  7. #17
    Quote Originally Posted by Daniil View Post
    No, it won't work.

    #{} is actual on the page only where the control is presented.
    so i need to somehow pass to the iframe clientId of control?

    you have idea what is the best way to do that mb? I could do this by queryString but not sure is it the best approach
  8. #18
    Is there a possibility to have several same ComboBoxes on the parent page?
  9. #19
    Quote Originally Posted by Daniil View Post
    Is there a possibility to have several same ComboBoxes on the parent page?
    There is such possibility in my case. Because combobox is only part of my custom server control.

    To be clear every my control has his own combobox with store and button.
    Last edited by ViDom; Dec 13, 2012 at 11:08 AM.
  10. #20
    So, a static id is not an option.

    Then yes, you shoud, probably, pass this a parameter to an iframe.

    Maybe, there is a better solution. I would investigate a sample if you could provide.
Page 2 of 5 FirstFirst 1234 ... 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