[CLOSED] Finding number of columns of the child grid in multilevel grid

  1. #1

    [CLOSED] Finding number of columns of the child grid in multilevel grid

    How to find the number of columns in the recently created grid level in multilevel grid. I want that in the success event of the directmethod call to BuildLeve in javascript.

    function loadLevel(expander, record, body, row) {
        if (body.rendered) { return; }
        if (record.data.ChildCount === 0) { return false; }
        
        if (record.get('UrlContactMailTo')) {
            record.data.UrlContactMailTo = '';
        }
    
        Ext.net.DirectMethods.ControlProxy.BuildLevel(expander.level + 1, record.id, expander.grid.id, record.data, expander.changeHeader, {
            eventMask: { showMask: true, msg: localeLang.loadText, tartget: "customtarget", customtarget: expander.grid.body },
            success: function () { Ext.net.Mask.hide(); body.parentElement.colSpan = body.parentElement.colSpan + 1; body.rendered = true; },
            failure: function (errorMsg) { var m = !Ext.isEmpty(errorMsg) ? errorMsg.substring(0, 1000) : ''; directEventFailure('loadLevel BuildLevel ' + m); }
        });
    
    };
    
    
    
    <DirectMethod()> _
            Public Sub BuildLevel(iLevel As Integer, sRecordID As String, sGridID As String, oRecord As String, bChangeHeader As String)
    
                Dim sStoreID As String = String.Format("L{0}_Store_{1}", iLevel, sRecordID)
                Dim sNewGridID As String = String.Format("L{0}_Grid_{1}", iLevel, sRecordID)
    
                Me.mRecord = oRecord
                '// ---------------- Store Creation -------------------------
                '// Create the reader and add records based on the selector type
                Dim reader As ABJsonReader = GetJsonReader(iLevel, sNewGridID)
    
                '// Create the available Store 
                Dim oStore = GetStore(reader, sStoreID, iLevel, sRecordID, oRecord)
    
                '// ---------------- Grid Creation -------------------------
                Dim oGrid As New Ext.Net.GridPanel With {.ID = sNewGridID, .StoreID = sStoreID, .AutoHeight = True, .StripeRows = True, .Cls = "nested-grid"}
                GetColumns(iLevel, oGrid)
    
                '// ---------View And Row Explander Creation -------------------------
                Dim view = New Ext.Net.GridView() With {.ID = sNewGridID + "_View", .ForceFit = True, .ScrollOffset = 0}
                view.Listeners.BeforeRefresh.Fn = "cleanMulti"
                oGrid.View.Add(view)
    
                Dim oExpander = GetRowExpander(iLevel, sNewGridID)
                oExpander.ChangeHeader = (bChangeHeader = "True")
                oGrid.Plugins.Add(oExpander)
    
                '// --------- Store and Grid Caching -------------------------
                Dim renderEl As String = oExpander.RenderEl(sRecordID)
                Ext.Net.X.[Get](renderEl).SwallowEvent(New String() {"mousedown", "mouseup", "dblclick"}, True)
    
                If bChangeHeader = "True" Then
    
                    Me.RemoveFromCache(sStoreID, sGridID, False)
                    oStore.Render()
                    Me.AddToCache(sStoreID, sGridID, False)
    
                    Me.RemoveFromCache(sNewGridID, sGridID, True)
                    oGrid.Render(renderEl, RenderMode.RenderTo)
                    Me.AddToCache(sNewGridID, sGridID, True)
    
                Else
    
                    Me.RemoveFromCache(sStoreID, sGridID)
                    oStore.Render()
                    Me.AddToCache(sStoreID, sGridID)
    
                    Me.RemoveFromCache(sNewGridID, sGridID)
                    oGrid.Render(renderEl, RenderMode.RenderTo)
                    Me.AddToCache(sNewGridID, sGridID)
    
                End If
    
            End Sub
    Last edited by Daniil; Apr 14, 2014 at 3:09 PM. Reason: [CLOSED]
  2. #2
    Hi @randhir,

    I would return a GridPanel's id from the DirectMethod and get a GridPanel instance inside a success handler. Having a GridPanel instance you should be able to find out an amount of its columns.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @randhir,

    I would return a GridPanel's id from the DirectMethod and get a GridPanel instance inside a success handler. Having a GridPanel instance you should be able to find out an amount of its columns.
    Can you give me an example, How you will get a gridpanel instance if the name of the grid is L2_Grid_100074115
  4. #4
    I would try:
    Ext.getCmp("L2_Grid_100074115")

Similar Threads

  1. Number of Columns in Tree grid
    By ashishrai in forum 1.x Help
    Replies: 0
    Last Post: Aug 22, 2012, 10:21 AM
  2. [CLOSED] number fields in grid/columns
    By marco.morreale in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: May 18, 2012, 5:22 PM
  3. [CLOSED] Grid Page Number
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 14, 2010, 12:46 PM
  4. Link in Grid with format number
    By bsnezw in forum 1.x Help
    Replies: 2
    Last Post: Oct 26, 2009, 2:50 PM
  5. [CLOSED] Link in Grid defined by 2 Grid Columns
    By macap in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 23, 2009, 7:47 AM

Tags for this Thread

Posting Permissions