Hybrid View
-
30 Sep 2010 5:02 PM #1
Sencha Touch - How function work?
Sencha Touch - How function work?
I have code as follow -
/ Project Button
var btnProject = new Ext.Button({
text: 'Project',
handler: ProjectList
});
// Function - ProjectList
var ProjectList = function (botton, event) {
....
}
// Function - closeList
var closeList = function (botton, event) {
....
}
My Question is -
is there any option, when I click first time on"btnProject", the "ProjectList" will be called and next time "CloseList" will be called?
-
30 Sep 2010 5:53 PM #2
No, but you could simulate it pretty easily:
Code:var close = true; new Ext.Button({ handler: function(btn){ close = !close; if(close){ closeList.apply(btn, arguments); }else{ ProjectList.apply(btn, arguments); } } });Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
30 Sep 2010 6:29 PM #3
Thanks for your replay. I have totally understood your coding. But I need more help to solve my problem. I have following function. When I click on Project button, it is displaying list of information. How can I close this list when I click next time?
// Function - ProjectList
var ProjectList = function (botton, event) {
Ext.regModel('Project', {
fields: ['ProjctName', 'ProjectNumber']
});
var groupingBase = {
tpl: '<tpl for="."><div class="project"><strong>{ProjectNumber}</strong> {ProjctName}</div></tpl>',
itemSelector: 'div.project',
singleSelect: true,
grouped: true,
indexBar: true,
store: new Ext.data.Store({
model: 'Project',
sorters: 'ProjctName',
getGroupString: function (record) {
return record.get('ProjctName')[0];
},
data: [
{ ProjectNumber: '20100003', ProjctName: 'Unversity of Queensland' },
{ ProjectNumber: '20100010', ProjctName: 'Unversity Project 01' },
{ ProjectNumber: '20100011', ProjctName: 'Unversity Project 02' },
{ ProjectNumber: '20900001', ProjctName: 'Old Windsor Rd Bus Shelter' },
{ ProjectNumber: '20100001', ProjctName: 'Bedrok Park Landscape' },
{ ProjectNumber: '20100005', ProjctName: 'Project 01' },
{ ProjectNumber: '20100006', ProjctName: 'Project 02' },
{ ProjectNumber: '20100007', ProjctName: 'Project 03' },
]
})
};
new Ext.List(Ext.apply(groupingBase, {
fullscreen: true
}))
}
-
30 Sep 2010 8:14 PM #4
What do you mean by "close"?
Code:Ext.setup({ onReady: function(){ var main = new Ext.Panel({ fullscreen: true, layout: 'card', items: [{ html: 'Initial Card', dockedItems: [{ xtype: 'toolbar', dock: 'top', items: [{ text: 'Show list', handler: function(){ main.setCard(1); } }] }] }, { html: 'List Card', dockedItems: [{ xtype: 'toolbar', dock: 'top', items: [{ text: 'Show main', handler: function(){ main.setCard(0); } }] }] }] }); } });Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
30 Sep 2010 8:30 PM #5
When I click on "Project" button, it will show list of projects. But next time click, it should be hide the frame. May be display another frame.
Similar Threads
-
Is Sencha working on native wrappers to package Sencha Touch apps for app stores?
By olin in forum Sencha Touch 1.x: DiscussionReplies: 10Last Post: 20 Jan 2012, 10:10 AM -
Could Ext Js and Sencha Touch work together?
By handitan in forum Sencha Touch 1.x: DiscussionReplies: 3Last Post: 26 Apr 2011, 1:25 PM -
Sencha Touch on iPhone v1 / iPod touch v1 ?
By palnap in forum Sencha Touch 1.x: DiscussionReplies: 4Last Post: 28 Oct 2010, 5:30 PM -
Sencha Touch contract work in New York City
By tfabacher in forum Sencha Touch 1.x: DiscussionReplies: 0Last Post: 12 Jul 2010, 10:04 AM



Reply With Quote