Search code examples
extjsextjs4extjs-mvc

how to modify store data before loading it into the combo list


I have a combo field with queryMode: 'remote' and the store has a structure similar to this:

{
   success: true,
   data: [
     {'name':'john','value':1},
     {'name':'mary','value':2}
   ]
}

How can I remove the first element of the data array if I want to, before it is loaded into the combo list?

I tried capturing the load event and splicing the data array but I didn't seem successful. A solution in the context of the one posted in this thread would really be helpful.


Solution

  • First of all, removing the first element in the UI is questionable, if you ever decide to expose your services through web services, that logic of removing the first element won't be there.

    That being said I think you can listen to the load event and do store.removeAt(0)