PDA

View Full Version : [CLOSED] TabPanel - ActiveIndex - Not working



sveins12
Aug 16, 2016, 4:32 PM
ActiveIndex doesn't work. I have also tried ActiveItem.



@{
var x = Html.X();
}
@(
x.TabPanel()
.ActiveIndex(1)
.Items(
x.Panel()
.Title("Panel0")
,
x.Panel()
.Title("Panel1")
)
)

fabricio.murta
Aug 16, 2016, 11:34 PM
Hello @sveins12!

I am afraid this setting is not meant to work on tab panels like you expect.

By its description (you can see using IntelliSense on your development environment), you read:


// Summary:
// A string component id or the numeric index of the component that should be
// initially activated within the container's layout on render. For example,
// activeItem: 'item-1' or activeItem: 0 (index 0 = the first item in the container's
// collection). activeItem only applies to layout styles that can display items
// one at a time (like Ext.layout.container.Card and Ext.layout.container.Fit)


And if you search forums for something like "TapPanel ActiveIndex", you can find a very very old thread mentioning it was made available. As of Ext.NET 0.6 -- whence it was called Coolite) but then you can find a earlier threads which indicates this no longer was the case since Ext.NET 1.0, probably due to conflicting applications of the same setting.

In this thread Vladimir suggests us to use ActiveTabIndex() instead: TabPanel 'ActiveItem/Index' property (http://forums.ext.net/showthread.php?15096).

And, by a matter of fact, this just worked for me here! Sorry it may look confusing, I didn't dig really deep for the actual reason this ceased to be applicant to Ext.NET but I could notice:
- it is not inherent from Sencha ExtJS
- it was once implemented exactly because it was confusing
- later, it was no longer actual, and a specific setting ActiveTabIndex was created to handle the same behavior.

It really looks like trouble trying to make it "general" as history indicates it probably suppressing the actual ActiveIndex functionality in some scenarios using the TabPanel.

I hope this helps!

sveins12
Aug 16, 2016, 11:48 PM
Thank you. ActiveTabIndex(1) works.