PDA

View Full Version : Extjs4 how to allow no conflict ID in form with defferrence tab.



korndeang
24 Apr 2013, 6:25 PM
I am new in Extjs

My application follow MVC by using tree menu and tab
Example:
- root
+ User
- Add User
- View User
By Click on tree "Add User" will add new tab "Tab Add User" and click "View User" add tab "Tab View User".
The problem each tab contain the same form (each item of form has the same ID) but form provide from deference View alias.

Note:I follow MVC
Controller: User.js (require view: add, view)
View/user/Add.js (form add) alias "userAdd"
View/user/View.js (the same form add) alias "userView"

Arg0n
25 Apr 2013, 12:09 AM
Do not give an id, if you aren't 100% sure that the view will be only displayed once.
So:

Remove the id
Before you add the tab, create a new instance of the form
I wrote a tabmanager for this usecases. All my forms getting itemIds instead. I use the same form for editing and creating and both can be open at the same time. So i give them the itemId: 'myForm-create' and
itemId: 'myForm-edit' for example. The Tabmanager will look for it when adding a tab and if it is already present, it will activate it instead of opening a new tab.

korndeang
25 Apr 2013, 5:25 PM
Thanks, It works by using itemId :) instead of ID