PDA

View Full Version : SetActiveItem not working



jedihua
22 Jun 2011, 3:10 PM
Hi, All:

I'm building a TapPanel with 3 taps and each tap contains a list. in each list, if you click an item, the setActiveItem function will be called and display a detail information for that item. There is a backbutton in the detail panel where you can navigate back to the list.

Here is the simple code

in List panel

var DetailCard = new Details({
ListCard: this.list
});
this.setActiveItem(resultDetailCard);


in Detail panel

this.ownerCt.setActiveItem(this.ListCard);

The issue is that when you load the program and you click on a tap panel and then click on a item in the list and then click the backButton in the detail panel, you can go back to your list. Its works fine.

But if you click on a tap and then click on another tap and then click the first tap again and do the whole thing above, the list will not appear after you click the backButton.

I checked the code line by line and all the attributes are well defined. I just got confused.

christocracy
22 Jun 2011, 3:32 PM
Gee...I can picture that all in my head perfectly...yea...

Without code...pretty hard to tell...

Perhaps it's because you're trying to make a TapPanel instead of *TabPanel*.

BTW, avoid using ownerCt to control a parent component like that.

jedihua
23 Jun 2011, 6:51 AM
Thanks for the reply. Here is the code sample.


new tabpanel{
items: [{
list1
},{
list2},{
list3}]
}

list1 = extend(panel,{
item = new list;
list.onSelect: function(selectionmodel, records) {
var DetailCard = new Details({
ListCard: this.list
});
this.setActiveItem(resultDetailCard);
}
}

DetailCard = extend(panel, {
this.toolbar.backbutton.handler: function() {
this.ownerCt.setActiveItem(this.ListCard);
}
})


This tabpanel works normal except that I click on list1 first and then without click any items in list1, I click list 2 or 3. and then click on list one again. Then I select an item on list 1 and then hit the backbutton in the detail panel. It will slide back but the list will not show up, just show an empty panel.

christocracy
25 Jun 2011, 7:53 AM
Please format your code snippets with proper indentation, it's a mess.

What is this class tabpanel with all lowercase?? ClassNamesAreCamelCased.

And what is this global method extend you're using??

All methods and classes in the library are attached to the Ext namespace.