0

In my application, I have a grid populated with some data, I am displaying 2 columns in the grid..ie, name and noOfScripts. But when I double click on the grid, I want scriptname and parameters also to be displayed( and the number of times it is displayed is based on the noOfScripts) in the Window/Form.

I am using Java Servlets for the backend, Now I am not sure if I have to add the script details into the same Main Class or not? How should I handle the script details?

Check this: this is how I add these data: Here

  1. Should I save scriptname and parameters along with the main data?
  2. Is it possible to store multiple values, if I add scriptname and parameters to the main Store? or should I create a different store for Script?
  3. If I am creating a different store called Scripts..How I should be mapping it to the data record? Are there any methods provided by ExtJs that helps achieve this?

Not sure If my explanation on the problem is clear or not. Do let me know if it is not clear, I will try to make it clear.

Please suggest me if there is something helpful. Any suggestions, ideas or references will help.

Thanks in advance

Community
  • 1
  • 1
user777777
  • 228
  • 4
  • 25

1 Answers1

0

I suggest you to create a model and a store for Script and on rowitem click - populate a window with the data from the Script store. ExtJS4 has support for model association (more here) but the mechanism is too complex so i prefer a simplier take on it:

Add MainModelId to Script model and simply filter the Script store every time you show your modal window (grid item click)

Community
  • 1
  • 1
  • Please let me know if this is right? `Ext.define('Script',{extend:'Ext.data.model', requires:'MainModel', id: 'MainModelId', fields: [ // script fields] });` But I have no clue about how to use filter with this..it will be very helpful if you could guide through that.. Thanks – user777777 Oct 27 '14 at 07:27
  • http://atechiediary.blogspot.com/2013/06/extjs-how-to-filter-data-of-store-in.html - check this one for example – Роман Гуйван Oct 27 '14 at 08:53
  • I have a doubt..Could you please clarify it...? Assuming,MainModel is a BookModel containing bookName,bookAuthor and noOfScripts. If i have to filter the Script Store based on bookName, then the scriptStore should have a column bookName right? – user777777 Oct 27 '14 at 11:22
  • As i said earlier it should have bookId (or bookName) to be filtered by this attribute. ExtJS5 has better model association, if you're looking for @the 100% right way@ i'd recommend you to check it first. – Роман Гуйван Oct 27 '14 at 11:58