PDA

View Full Version : [CLOSED] How can I add one item "Refresh" to the tab context menu?



wangyi
Aug 15, 2013, 1:44 AM
I have a TabPanel Control in page. Each tab has a context menu with three items: Close Tab, Close Other Tabs, Close All Tabs.
How can I add one item "Refresh" to the tab context menu?
And How can I fire the "Refresh" event and refresh the tab content page?
Thanks for your answer.

6762

Baidaly
Aug 15, 2013, 2:38 AM
Hello!

You can use extraItemsTail: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.ux.TabCloseMenu-cfg-extraItemsTail

To fire event you can use fireEvent method: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.util.Observable-method-fireEvent

However, I think it could be not necessary if you provide more details about your requirements.



<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html>

<html>
<head runat="server">
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:TabPanel runat="server">
<Plugins>
<ext:TabCloseMenu runat="server">
<CustomConfig>
<ext:ConfigItem Name="extraItemsTail" Value="[{
text: 'New Menu Item',
listeners: {
click: function() {
Ext.Msg.alert('Tab Click', 'Clicked');
}
}
}]" Mode="Raw" />
</CustomConfig>
</ext:TabCloseMenu>
</Plugins>
<Items>
<ext:Panel runat="server" Title="Panel1"></ext:Panel>
</Items>
</ext:TabPanel>
</form>
</body>
</html>

jamesand
Sep 05, 2013, 10:36 AM
Hi wangyi, did you resolved the issue? I'm trying to add a refresh button for each tab.

wangyi
Sep 05, 2013, 10:45 AM
<ext:ConfigItem Name="extraItemsTail" Value="[
{
text: 'Refresh,
listeners: {
click: function() {

var currtab = App.TabPanel_Content.getActiveTab();

if( currtab.title == 'Main' )
{
App.direct.RefrushPortal();
}
else
{
currtab.loader.load();
}
}
}

jamesand
Sep 05, 2013, 11:32 AM
Hi wangyi. Thank you for your quick response. I cannot make it work. Could you please post more code?

I may be close anyway with my current code:


<ext:Panel
ID="Tab1"
runat="server"
Title="Inicio"
Icon="House"
BodyStyle="background-color: transparent;"
AutoScroll="true">
<TabMenu>
<ext:Menu ID="Menu1" runat="server">
<Items>
<ext:MenuItem ID="MenuItem1" runat="server" Text="Reload">
<DirectEvents>
<Click OnEvent="Reload1" Type="Load"/>
</DirectEvents>
</ext:MenuItem>
</Items>
</ext:Menu>
</TabMenu>
<Content>
<ext:Container ID="Container1" runat="server">
<Content>
<uc1:Inicio ID="ucInicio" runat="server"/>
</Content>
</ext:Container>
</Content>
</ext:Panel>


Public Sub Reload1(ByVal sender As Object, ByVal e As Ext.Net.DirectEventArgs)

Tab1.Reload()

End Sub

That doesn't reload the tab!

Daniil
Sep 05, 2013, 2:23 PM
Hi @jamesand,

The Reload method makes sense only if you use a Loader.

In your case, please try:

Tab1.UpdateContent()

jamesand
Sep 05, 2013, 5:18 PM
Hi Daniil, I already tried it and it makes all my controls dissapear...

Daniil
Sep 06, 2013, 4:30 AM
Could you, please, provide a full test case to reproduce?

jamesand
Sep 06, 2013, 10:48 AM
No, I'm sorry. I tried it. But it has something to do with another tab cause it depends on what others tab contains that ir works or not.

How the content of another tab can have an impact?

Daniil
Sep 06, 2013, 11:58 AM
How the content of another tab can have an impact?

Hard to say.

jamesand
Sep 06, 2013, 1:35 PM
I'm wrking to discover the issue. If I find anything I will let you know.