1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    5
    Vote Rating
    0
    shadab.gaur1 is on a distinguished road

      0  

    Default ComboBox not getting update with newly added or removed value from it on button click

    ComboBox not getting update with newly added or removed value from it on button click


    I am creating a filtering form that contains various combo box and buttons. One combo box is used to display all stored filters from DB.
    Whenever I save a new filter or delete an existing filter by clicking "Save" /"Remove" button respectively, the combo box does not reflect with latest changes. Even I have writen code to update dataStore (used in that combo box) with latest changes in "success" of ajax call of save and remove. Means, datastore is getting update with latest changes but it does not appear in that combo box.

    I always have to hide filtering form on click of "Save" / "Remove" button and when I reload that filtering form, all filters combo box displays all the filters correctly (with latest changes). Means, to see changes in combo box, I have to close the form and then reload it. But it's pathetic.

    I am sure there must be a way to reflect changes in combo box without closing and reloading of filtering form.

    I am expecting - when user click on "save" / "Remove" button - changes must be reflect in combo box -

    Below is my code snippet-
    Following code usedto create combo box and filled with DataStore
    -------
    -------
    },
    {
    columnWidth: .6, border: false, layout: "form",
    items: [
    {
    xtype: "combo",
    fieldLabel: "Previously Stored Criteria",
    name:'STORED_CRITERIA',
    width: 220,
    store: storedCriteriaDataStore.collect("ALARM_FILTER_NAME", true, true),
    mode: "local",
    typeAhead: false,
    triggerAction: "all",
    editable: false,
    listeners:{select:{fn:function(combo, value) {
    // fetching details from db to display in rest of the fields of filtering form }} }
    }
    ]}

    Following code is of "Save" button - used to save filter into DB.


    {
    text: 'Save',
    iconCls:'save-icon',
    handler: function(){

    Ext.MessageBox.confirm(" <p>Confirm Save","Really want to save this filter?</p>",
    function(option){
    if(option == "yes"){
    var form = filterFieldForm.getForm();
    if(form.isValid()){
    form.submit({
    url:'AFServlet',
    waitMsg:'Saving Data...',
    params:{
    action:'addFilter',
    NE: NID
    },

    success: function (result, request) {
    // refetching latest data to update dataStore for filter combo box
    storedCriteriaDataStore.removeAll();
    storedCriteriaDataStore.load({
    params:{
    action:'sendAllStoredCriteria',
    NE: NID
    }
    });
    var obj = Ext.util.JSON.decode(request.response.responseText);
    Ext.message.msg('Criteria-'+obj.action, Filter Criteria has been successfully '+obj.action);
    alarmFilterWindow.hide();
    }, //end of Success

    failure:function(result, request) {
    var obj = Ext.util.JSON.decode(request.response.responseText);
    Ext.MessageBox.alert(Filter Save Failed.', obj.errors.reason);
    }//end of failure
    });
    }else{
    Ext.MessageBox.alert('Save Failed.', Filter Information could not be Saved successfully! Make sure all fields are valid.');
    }
    }
    });
    }//end of handler fn
    },

    I just started working in Ext JS 2 weeks back. I am struggling in above issue. Please help me out and really it will be a great great help for me.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Vote Rating
    751
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I don't see where you are setting the value.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    5
    Vote Rating
    0
    shadab.gaur1 is on a distinguished road

      0  

    Default


    Thanks Mitchell Simoens for your reply.

    I am using "Alarm_filter_name" of data store "storedCriteriaDataStore " to populate combo box - See in below code snippet:
    ---------------------------
    xtype: "combo",
    fieldLabel: "Previously Stored Criteria",
    name:'STORED_CRITERIA',
    width: 220,
    store: storedCriteriaDataStore.collect("ALARM_FILTER_NAME", true, true),
    mode: "local"
    -------------------------

    On click of "Save" button, one server side call goes to store "alarm_filter_name" with some other data into the database.
    In "success" of ajax call of "Save" button, I am loading data store "storedCriteriaDataStore" again so that this data store gets updated with latest value.

    Please see the below code snippet -

    text: 'Save',
    iconCls:'save-icon',
    handler: function(){

    Ext.MessageBox.confirm(" <p>Confirm Save","Really want to save this filter?</p>",
    function(option){
    if(option == "yes"){
    var form = filterFieldForm.getForm();
    if(form.isValid()){
    form.submit({
    url:'AFServlet',
    waitMsg:'Saving Data...',
    params:{
    action:'addFilter',
    NE: NID
    },

    success: function (result, request) {
    // refetching latest data to update dataStore for filter combo box
    storedCriteriaDataStore.removeAll();
    storedCriteriaDataStore.load({
    params:{
    action:'sendAllStoredCriteria',
    NE: NID
    }
    });

    At this point of time after reloading of data store in success of ajax, the data store "storedCriteriaDataStore" contains latest data (even I have varifies this).

    As I am using "storedCriteriaDataStore" to populate combo box, so this combo box should show all latest values in it.

    BUT still the combo box shows the OLD values, it does not get update with newly added value.

    AND, if I close the form and re-open it, after that this combo box shows all values in it.
    But without closing the form, it shows old values only, it does not reflect latest changes.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar