[CLOSED] Question about component loader

  1. #1

    [CLOSED] Question about component loader

    Hello

    I begin to play with component loader as it is a powerfull way to add component to other one, but I have a question.

    I made a tabpanel with 2 tabs. Second tabs will be loaded by a component loader on first activation BUT i want to clear this tab and reload if I change a parameter.

    See this code :

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="TestComponentLoader.aspx.vb" Inherits="VisualManagement.TestComponentLoader" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head runat="server">
            <title></title>
            <script language="javascript" type="text/javascript">
                clearPanel = function ()
                {
                    App.tabHistorique.clear();
                }
    
            </script>
        </head>
        <body>
    
     
            <form id="form1" runat="server">
                <ext:ResourceManager runat="server" ID="ResourceManager">
                </ext:ResourceManager>
    
                <ext:Panel runat="server" Width="500" Height="500" Layout="FitLayout">
                    <TopBar>
                        <ext:Toolbar runat="server">
                            <Items>
                                <ext:NumberField 
                                    ID="txtToSeek" 
                                    runat="server"
                                    FieldLabel="Value to seek" 
                                    AllowBlank="false"
                                    BlankText="mandatory." 
                                    LabelWidth="80">
                                </ext:NumberField>
                                <ext:Button runat="server" Text="clear Panel">
                                    <Listeners> 
                                        <Click Handler="#{tabHistorique}.removeAll()"></Click>
                                    </Listeners>
                                </ext:Button>
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                    <Items>
                        <ext:TabPanel ID="tabRMA" runat="server" Height="200" Width="350">
                            <Items>
                                <ext:Panel ID="tabLast" runat="server" Border="false" Layout="FitLayout" Title="Some stuff">
                                </ext:Panel>
                                    <ext:Panel ID="tabHistorique" runat="server" Border="false" Title="Historique" Layout="FitLayout">
                                    <Loader ID="Loader1" runat="server" Url="LoadHistorique.ashx" Mode="Component" >
                                        <LoadMask ShowMask="true"></LoadMask>
                                        <Params>
                                            <ext:Parameter Name="RMA" Value="#{txtToSeek}.value" Mode="Raw"></ext:Parameter>
                                        </Params>
                                    </Loader>
                                </ext:Panel>
                            </Items>
                        </ext:TabPanel>
                    </Items>           
                </ext:Panel>
            </form>
        </body>
    </html>
    when txtToSeek change I want to update the second tab as the contents will depend of value in txtToSeek field.

    The ashx that made component (very basic at this time and sorry for vb code)

    Imports System.Web
    Imports System.Web.Services
    Imports Ext.Net
    
    Public Class LoadHistorique
        Implements System.Web.IHttpHandler
    
        Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
            Dim MyComponents As List(Of AbstractComponent) = New List(Of AbstractComponent)
    
            Dim myTab As New TabPanel
    
            For i As Integer = 0 To 10
                Dim myPanel As New Panel
                With myPanel
                    .Title = "Panel" + i.ToString
                End With
                myTab.Add(myPanel)
            Next
    
            context.Response.ContentType = "application/json"
    
            ComponentLoader.Render(myTab)
    
    
        End Sub
    
        ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
            Get
                Return False
            End Get
        End Property
    
    End Class
    Another question, how can I get RMA param in handler? I look at context data but found nothing so far. EDIT : found : My.Request.Form(0) conatins my param.

    EDIT 2 I found solution here : http://forums.ext.net/showthread.php...-a-partialview
    Last edited by Daniil; Jan 23, 2013 at 3:44 AM. Reason: [CLOSED]
  2. #2
    Hi @feanor91,

    So, can we just mark the thread as closed?
  3. #3
    Please note that if you set RemoveAll="true" for Loader then previous widgets inside container will be deleted automatically
    To intiate reloading when text field is change you can use Change event of the field
    <Change Handler="#{tabHistorique}.getLoader().load();"/>
  4. #4
    Danii : yes you can
    Vladimir: ok, I will check

Similar Threads

  1. [CLOSED] reference of a control loaded by component loader
    By mirwais in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 28, 2012, 1:05 PM
  2. [CLOSED] Component Loader
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 13
    Last Post: Nov 13, 2012, 3:08 PM
  3. [CLOSED] Access Child items within loader Component
    By Digital.Dynamics in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Jun 12, 2012, 4:09 PM
  4. Add Ext JavaScript Component to Component
    By geoffrey.mcgill in forum Examples and Extras
    Replies: 3
    Last Post: Mar 10, 2010, 12:38 PM
  5. Replies: 1
    Last Post: May 22, 2009, 7:38 AM

Posting Permissions