noromamai
16 Dec 2011, 8:01 AM
I have a list that has a store in it that i sort by the property 'name'. after adding a record to the store i want to get it's 'id'. I'm used to using Mysql/PHP and just use mysql_insert_id() to get the 'id' of the just inserted record. So what i used with sencha was the last() method, but this gives the last item in the store depending on how it is sorted (which is logical, just didn't occur to me when i wanted to do what i needed). Right now i resort the store on the 'id' property, use last() and resort again so the list is still displayed the way it should be.
Shouldn't there be a method for a store that will give you the id of the last inserted record? This should be very useful in a lot of situations (unless the stores used are always sorted by id). Or am i missing something? Is there an easier way for me to do what i am doing?
Shouldn't there be a method for a store that will give you the id of the last inserted record? This should be very useful in a lot of situations (unless the stores used are always sorted by id). Or am i missing something? Is there an easier way for me to do what i am doing?