1. #1
    Sencha User
    Join Date
    Feb 2009
    Posts
    264
    Vote Rating
    0
    Stephan123 is on a distinguished road

      0  

    Default add a record to jsonStore

    add a record to jsonStore


    Hello !

    I have a jsonStore:

    Code:
    var store = new Ext.data.JsonStore({
            url: '../datenbank.php',
            root: 'data',
            idProperty: 'id',
            totalProperty: 'count',
            fields: ['id', 'date']
        });
    
        store.load();
    I will add a record to this store:

    Code:
    var form = new Ext.form.FormPanel({
        width: 400,
        height: 100,
        title: 'Eingabe',
        renderTo: 'form',
        items: [{
            xtype: 'datefield',
            fieldLabel: 'Sperrtage'
        }],
         buttons: [{
            text: 'eintragen',
            listeners: {
               click: function(){
                 // get the first rcord
                 var currentRecord = store.getAt(0);
                 // clone the record
                 var newRecord = currentRecord.copy();
                 // set new value in the new record
                 newRecord.set('100','25.10.2011');
                 
                 // add the nwe record to the store
                 store.add(newRecord);
    
                  // confirm changes
                  store.confirmChanges();
                 
               }
            }
         }]
    });
    The first load of the store works fine.
    When i add the record to the store i get an error.

    Your sincerly

    Stephan

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Posts
    264
    Vote Rating
    0
    Stephan123 is on a distinguished road

      0  

    Default solved

    solved


    Here the script:

    Code:
    listeners: {
               click: function(){
                    var newRecord = Ext.data.Record.create([{name: 'id'},{name: 'date'}]);
                    store.add(new newRecord({id: '100', date: '25.10.2011'})); 
                  }          
               }

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