Results 1 to 10 of 10

Thread: GridPanel's delete record Event

  1. #1

    Exclamation GridPanel's delete record Event

    Hello guys!

    I have an editable gridpanel where I can modify or delete a record.
    When I modify a record I can use the expression:
    Ext.getCmp('mygrid').getStore().modified[0].modified;

    in order to get the modified record's changes.

    As I've seen with Firebug there exist in object Ext.getCmp('mygrid').getStore();
    an array removed[] (for deleted records I suppose) in accordance with the array modified[].
    But the weird thing is that the array removed[] is never filled with the deleted records data(after calling Ext.getCmp('mygrid').getStore().removeAt(index); ).

    Is there an appropriate method in order to get the deleted records from a gridpanel?

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    There is no gridpanel delete record event.

    That said, you have full control over coding how records are deleted by user interaction. why don't you store the reference to the record in an array?

  3. #3

    Default

    Actually, I refered to the gridpanel's store delete event.
    As a solution I've set a listener to my store, where in 'delete' event I pushed the deleted records to an array.

    I was wondering A) if there were an appropriate direct method instead and why the corresponding removed[] array as in Firebug displayed is never filled with data, in contrast with the modified[] array

  4. #4
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    That's not what the title says .

    Question - do you not invoke an ajax request when a delete is requested? What if the user deletes 5 records and forgets to press 'save'?

  5. #5

    Default

    You are right, I've edited wrong the title

    I my application the user deletes any number of records and the server is notified after pressing the user a save button.
    Through this action I send the custom array of the deleted records, as I've described.

  6. #6
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    Why not just use a writable Store? It does it all for you.

  7. #7

    Default

    Hello Animal,

    Do you mean to use a custom writer in my store instead of the default?( as it is in the example http://dev.sencha.com/deploy/dev/exa...er/writer.html )

  8. #8
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    Are you using a writable Store already? If so, I don't understand the problem. It takes care of creating, reading, updating and destroying for you.

  9. #9

    Default

    I'm using the Ext.data.Store && Ext.data.JsonReader.

    My concern was how can I notify the server with the deleted records(e.g. id of each record).
    User first deletes a record and server is notified after pressing the user a save button.

    For the modified records there is an Ext.data.Store method getModifiedRecords(), but for the deleted records there is not a corresponding method. So, I create a function for the Store's remove event, which function creates an array of deleted records.

    Is there Animal a direct method for it?

  10. #10
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    Use a writable Store. Configure it with a writer and it does all of this.

Similar Threads

  1. delete/add a record in my extend gridpanel
    By kurt schrauwen in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 15 Mar 2010, 12:43 AM
  2. delete/add a record in my extend gridpanel
    By kurt schrauwen in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 12 Mar 2010, 5:16 AM
  3. delete record in store
    By nofx in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 7 Jun 2009, 11:25 PM
  4. Delete Record using Check Box
    By karan.kapur in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 21 Apr 2009, 6:41 AM
  5. Delete last record but this record still show in the grid
    By holala in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 18 Jun 2008, 4:40 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •