G
G
Guy Fawkes2011-12-22 16:51:21
ExtJS/Sencha
Guy Fawkes, 2011-12-22 16:51:21

Nested Data Loading in ExtJS 4?

Hello.
It seems to me that the possibility of linking models and loading related data, declared in ExtJS 4, is made at least strange and does not correspond to realities during development. Let me explain: I have a model of trainings, users and training connections with users (which also contains a certain amount of additional data, including foreign keys, in addition to the user_id key, to the same user table: assigner_user_id and verifier_user_id (who assigned the training and who checked )). In the grid, of course, I would like not to display to the user the id of users that say little, but their names and surnames. I believe that it is wrong to make links with the user table when choosing a list from the model (I use ZF) of training and user links, since the model should not “know” about the presence of additional, unnecessary data for it. It is also wrong to combine data in the controller (by making another request to the model of already directly users with IN, listing all the necessary user ids from the training data received from the model): the view should deal with the final manipulations with the output of data. Therefore, we give it JSON with two main keys - trainings and users.
And in the view, there is just no way to load two storages so gracefully in order to use the first and last names obtained by identifier from the storage with users when rendering the columns in the grid. They tell me: make a hierarchical structure (with duplicate data!, because if several trainings can have links to the same users), but in this case it’s easier for me to do the data merging already on the controller side. The question arises - is it possible to define loading behavior in a more appropriate way?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question