Results 1 to 4 of 4

Thread: Best method for using writers with multiple primary keys?

  1. #1
    Sencha Premium User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    579

    Default Best method for using writers with multiple primary keys?

    So if I have a store that needs a writer, and the table the data is taken from has multiple primary keys, what is the best method for implementing the store?

    If I use one of the primary keys as the ID, if I delete something I wont have sufficient data when the writer sends it back to the backend. I could concat the primary keys as an ID and then splice them on the backend, but that is ugly. Is there a better solution to the issue?

  2. #2
    Sencha User
    Join Date
    Jun 2009
    Location
    Colorado
    Posts
    51

    Default

    Just a shot in the dark here, but does setting writeAllFields on the writer send all field for deleted records as well as updated records?

  3. #3
    Sencha Premium User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    579

    Default

    I believe it is only update

  4. #4
    Sencha User
    Join Date
    Jun 2009
    Location
    Colorado
    Posts
    51

    Default

    I can only offer suggestions as I do not have time to try it myself :-\

    But perhaps overwriting the destroyRecord method for your writer to include more than the id will do it?:

    Code:
        destroyRecord : function(rec){
            if(this.encodeDelete){
                var data = {};
                data[this.meta.idProperty] = rec.id;
                return data;
            }else{
                return rec.id;
            }
        }

Similar Threads

  1. Questions on Models/Stores and primary and foreign keys
    By jeronimo in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 22 Aug 2010, 5:59 PM
  2. Writing custom writers in 3.1
    By zefciu in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 29 Dec 2009, 6:16 AM
  3. Datalist with multiple selection's with keyboard shift+up/down keys.
    By nitipatil in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 17 Jun 2008, 3:18 AM
  4. deleting from gridpanel with two primary keys
    By dax in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 1 Feb 2008, 8:05 AM

Posting Permissions

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