How to add/remove fields from store Ext.net 2.2

  1. #1

    How to add/remove fields from store Ext.net 2.2

    I was updating the store fields dynamically with the code mentioned in below snippet for earlier versions of Ext.net but now i am not getting alternative approach to solve my issue.
    var fields="field1~field2~field3";
    
    function reconfigFields(store, fields) {
                var fieldArr = fields.split('~');
                if (fieldArr.length == 1 && fieldArr[0] == '') { return; }
                var i;
                while (store.fields.getCount() > 0) {
                    store.fields.removeKey(store.fields.getKey(store.fields.itemAt(0)));
                    store.fields.removeAt(0);
                }
                for (i = 0; i < fieldArr.length; i++) {
                    store.fields.add(fieldArr[i], new Ext.data.Field({
                        name: fieldArr[i]
                    }));
                }
            }
    Now, i am able to remove all fields by the function store.removeFields(); but to add new fields i am not getting any method. Please help me to solve my issue with Ext.Net upgrade.
    Last edited by rishu; Jun 28, 2013 at 11:02 AM.
  2. #2
  3. #3
    I need a way to do it through js side and got the solution by using store.model.setFields(fieldsArray);

Similar Threads

  1. [CLOSED] Store.remove Changes Store Sirty Flag
    By bethc in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 18, 2011, 9:04 PM
  2. [CLOSED] Store.remove(record) and Store.reload()
    By capecod in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 08, 2010, 10:03 AM
  3. [CLOSED] [1.0] Remove fields from FormPanel
    By danielg in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 24, 2010, 1:06 PM
  4. [CLOSED] [1.0] Problem with Multifield.Fields.Remove component
    By PoloTheMonk in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 22, 2010, 6:42 PM
  5. Add and remove fields to PropertyGrid control
    By yarlenvas in forum 1.x Help
    Replies: 0
    Last Post: Mar 03, 2009, 5:56 PM

Posting Permissions