-
12 Feb 2011 5:04 AM #1
DockedItems for Dataview
DockedItems for Dataview
Is there any possible method to provide docked items for Dataview, as of for now its not a property.
-
14 Feb 2011 5:51 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 435
You have to wrap the DataView in a Panel to be able to use DockedItems config. DataView used to extend Panel but that was dumped in one of the beta builds last year in favor of this.
Also, make sure you use FitLayout on the Panel if you want scrolling to work properly on the DataView.Last edited by mitchellsimoens; 14 Feb 2011 at 5:52 AM. Reason: Added FitLayout comment
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
14 Feb 2011 2:54 PM #3
I have a same issue. Is their any sample example?
-
14 Feb 2011 8:13 PM #4
As mitchel said there is no dockedItems for dataview, we have to use Panel and add dataview as its item
Code:new Ext.Panel({ fullscreen: true, dockedItems: { xtype: 'toolbar', title: 'Dataview Dock' }, items: [{ xtype: 'dataview', store: new Ext.data.Store({ autoload:true, fields:['firstName','lastName'], sorters: ['lastName'], data: [{ firstName: 'Thomas', lastName: 'Alexander' }, ] }), itemSelector: 'div.users', tpl: new Ext.XTemplate('<div class="users"><tpl for="."><div><span>{firstName}</span><span>{lastName}</span></div></tpl></div>') }] })
-
14 Feb 2011 8:22 PM #5
thanks for your information. Could you look at the following thread? I am in trouble.
http://www.sencha.com/forum/showthre...-is-not-firing
-
16 Feb 2011 8:39 PM #6
I have tried your coding and it is working.
However, I am facing another problem regarding on the above issue.
Suppose I have "ProjectList" and when I will click one item from ProjectList it will show "ProjectListDetails"
ISSUE: when I click, I am getting Project Name and Project Number.
How do I send "SelecedProject" information(that is - Project Name, Project Number) to following "Panel"Code:rojectList.on('itemtap', function (ProjectList, index, item, e) { var SelectedProject = ProjectList.store.data.items[index].data; var templateSelectedProject = new Ext.XTemplate( '<p>{ProjectName} {ProjectNumber}</p>' ); var str = templateSelectedProject.apply(SelectedProject); /* from here I am getting Project Name and Project Number*/ });
Code:new Ext.Panel({ fullscreen: true, dockedItems: { xtype: 'toolbar', title: 'Project Details' }, items: [{ xtype: 'dataview', store: SelectedProject, // needed to modify itemSelector: 'div.users', tpl: new Ext.XTemplate('<div class="users"><tpl for="."><div><span>{ProjectName}</span><span>{ProjectNumber}</span></div></tpl></div>') }] })
-
16 Feb 2011 8:52 PM #7
Its seen that your ProjectDetails Dataview have a store associated.
So its better to loadata to the dataview store when you select an item from list.
-
16 Feb 2011 8:58 PM #8
If I want to display select item name (Project A) what should I do? Could you give me any example?
In Project list, there is already name of Project (ex. Project A). And I want to display "Project A" into the ProjectDetail list. How can I do that?
-
16 Feb 2011 9:52 PM #9
Code:SelectedProject.loadData([{ProjectName:'project name',ProjectNumber:'project number'}])
-
17 Feb 2011 5:11 AM #10Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 435
You have a DataView and when you click on it are you wanting to load that Model's information into another DataView?
DataViews should be used if there is more than one Model (record) that you want to view, say you have multiple projects.
If you want to only view one project then make an Ajax request and populate a Template into a Panel (or Container/Component).
If you are rendering the Panel for the first time then you use the data config in the Panel and not the update function. If the Panel is already rendered and you want to push data to it, then you do not use the data config option and you use the update function. Both will use an object.Code:var panel = new Ext.Panel({ ... tpl: new Ext.Template( '<div>{ProjectName}</div>' ), data: Model.data // config option }); panel.update(Model.data); //update function
If you would like more of a full example, let me know and I will write something real quick.Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
Similar Threads
-
Can you dymanically edit the dockedItems?
By rballman in forum Sencha Touch 1.x: DiscussionReplies: 6Last Post: 8 Apr 2011, 1:47 AM -
Can you dymanically edit the dockedItems?
By rballman in forum Community DiscussionReplies: 0Last Post: 31 Jan 2011, 11:54 PM -
dockedItems not in the API documentation
By DanMcCoy in forum Sencha Touch 1.x: DiscussionReplies: 1Last Post: 26 Sep 2010, 7:37 PM -
dockedItems ignoring title in item
By profunctional in forum Sencha Touch 1.x: DiscussionReplies: 5Last Post: 6 Jul 2010, 6:18 AM


Reply With Quote