1. #1
    Sencha User
    Join Date
    May 2010
    Posts
    111
    Vote Rating
    1
    sajan is on a distinguished road

      0  

    Default Answered: problem creating a new record and updating a new record in a store

    Answered: problem creating a new record and updating a new record in a store


    Dear All,
    I am facing one problem.
    I want to add new record to my existing store and also want to modify some records in the store. but I am not able to my code is
    Code:
    var RecToUp = Ext.getCmp("transGridId").getStore().recordType;
    									var r = new RecToUp({
    								 	T10F2: this.Trans_key,
    								    T6F2: this.NameKey,
    								     }); 
    									r.commit();
    									store.add(r);
    									store.commitChanges();
    but it is saying RecTOUp is not a constructor.
    So please help me what is wrong here
    thanks

  2. Please indent your code so that it is readable before you post it.

    You don't need to create the record yourself. You can just do something like this:

    Code:
    Ext.getCmp("transGridId").getStore().add({
        T10F2: this.Trans_key,
        T6F2: this.NameKey
    });
    It will create the record for you from the model.

  3. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,337
    Answers
    101
    Vote Rating
    75
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    try using Ext.getCmp("transGridId").getStore().model.create();

  4. #3
    Sencha User
    Join Date
    May 2010
    Posts
    111
    Vote Rating
    1
    sajan is on a distinguished road

      0  

    Default


    Thanks,
    I tried but it also didnot work.
    Still showing the same error
    Please help me out

    thanks

  5. #4
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,344
    Answers
    498
    Vote Rating
    249
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    Which version of ExtJS are you using?

  6. #5
    Sencha User
    Join Date
    May 2010
    Posts
    111
    Vote Rating
    1
    sajan is on a distinguished road

      0  

    Default


    I am doing everything with ext designer

    the ext version is ext-4.0.2a.
    I also tried
    Code:
    var ObjectRecordType = Ext.data.Record.create(['T10F2', 'T6F2' ]);									var rec = new ObjectRecordType({
    									T10F2: thisTrans_key,
    								  	T6F2: "ram"});
    
    Ext.getCmp("transGridId").store.add(rec);

    but this is also not working.
    I dont want to reload my store all the time to refresh the grid so please do helo me



    thanks

  7. #6
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,344
    Answers
    498
    Vote Rating
    249
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    Please indent your code so that it is readable before you post it.

    You don't need to create the record yourself. You can just do something like this:

    Code:
    Ext.getCmp("transGridId").getStore().add({
        T10F2: this.Trans_key,
        T6F2: this.NameKey
    });
    It will create the record for you from the model.

  8. #7
    Sencha User
    Join Date
    May 2010
    Posts
    111
    Vote Rating
    1
    sajan is on a distinguished road

      0  

    Default


    Hi,
    I think it created the record but it is still not updating the grid.
    Please help me out

    thanks

  9. #8
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,344
    Answers
    498
    Vote Rating
    249
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    How are you checking that the record has been added?

    Are there any error messages?

    Do the fields in the data map properly onto the fields in the model? Note that they will not be run through the reader.

    Can you post the configs for your model, store, grid, etc.? Even better, a complete, minimal test case would be ideal.

    Can you confirm you're having this problem in multiple browsers?

  10. #9
    Sencha User
    Join Date
    May 2010
    Posts
    111
    Vote Rating
    1
    sajan is on a distinguished road

      0  

    Default


    Sorry My mistake,
    Now it is adding record in the store + the grid
    but it is adding at the end of the grid,
    is it possible to add it as first record on the grid (I mean in the first position)
    That will be really nice
    if it can be done thanks

  11. #10
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,344
    Answers
    498
    Vote Rating
    249
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    Use insert() with an index of 0 instead of add().

    http://docs.sencha.com/ext-js/4-0/#!...-method-insert

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