[CLOSED] Binding Store to Datatable VERY slow...

  1. #1

    [CLOSED] Binding Store to Datatable VERY slow...

    I am binding a store to a datatable that I have created in code-behind. The store uses a JsonReader, but it is very slow, it takes a few seconds to load the list of maybe 100 rows. And during the load, no load mask is showing either. This is much slower than binding the store to a sql data source... but I don't have that option here.

    The column with the text loads first and then it takes a long time to load the command columns...

    Is there a better way to bind the store to the datatable? Is there a way to show the loading mask?

    Any suggestions would be appreciated... Thanks

    <%@ Page Language="vb"%>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <%@ Import Namespace="System.Configuration" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="Microsoft.ApplicationBlocks.Data" %>
    <%@ Import Namespace="Helpers" %>
    <%@ Import Namespace="Helpers.FormatHelpers" %>
    <%@ Import Namespace="System.IO" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head2" runat="server">    
        <script runat="server">   
            Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
                'load the navigation menu
                If Not Page.IsPostBack Then
                End If
            End Sub
        <script runat="server">          
            Public Sub BuildNavBar()
                Dim cs As String = Connection.ConnectionString(Request.ServerVariables("SERVER_NAME"))
                Dim ds As DataSet = SqlHelper.ExecuteDataset(cs, "spNavBarGetItems")
                Dim dtNavBar As DataTable = ds.Tables(0).Clone
                Dim c As DataColumn = New DataColumn("Level", System.Type.GetType("System.Int32"))
                AddChildren(ds, dtNavBar, -1, 0)
                Store1.DataSource = dtNavBar
            End Sub
            Public Sub AddChildren(ByVal ds As DataSet, ByRef dtNavBar As DataTable, ByVal ParentID As Integer, ByVal Level As Integer)
                Dim drSiblings() As DataRow = ds.Tables(0).Select("ParentID = " &amp; ParentID)
                'we are on a new level
                Level += 1
                Dim dr As DataRow
                For Each dr In drSiblings
                    Dim ID As Integer = dr("ID")
                    Dim PageTitle As String = dr("PageTitle")
                    'Dim SortOrder As Integer = dr("SortOrder")
                    Dim Visible As Boolean = dr("Visible")
                    Dim URL As String = dr("URL")
                    'add this page to the nav bar data table
                    Dim row As DataRow
                    row = dtNavBar.NewRow()
                    row("id") = ID
                    row("PageTitle") = PageTitle
                    row("URL") = URL
                    row("Visible") = Visible
                    row("Level") = Level                
                    AddChildren(ds, dtNavBar, ID, Level)                
            End Sub
        <form id="form1" runat="server">
        <ext:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Debug" InitScriptMode="Inline">
        <ext:Store ID="Store1" runat="server">
                <ext:JsonReader ReaderID="ID">
                        <ext:RecordField Name="ID" Type="Int"/> 
                        <ext:RecordField Name="PageTitle" Type="String"/> 
        <ext:ViewPort ID="ViewPort1" runat="server">
                <ext:GridPanel ID="GridPanelSortOrder" runat="server" 
                                Title="" >
                            <ext:Column ColumnId="PageTitle" Align="Left" Header="PageTitle" DataIndex="PageTitle" Resizable="false" MenuDisabled="true" Width="440" />
                            <ext:CommandColumn ColumnID="Commands" Width="20">
                                    <ext:GridCommand Icon="PageWhiteGet" CommandName="moveup" QTipText="Move Up"></ext:GridCommand>
                                    <ext:GridCommand Icon="PageWhitePut" CommandName="movedown" QTipText="Move Down"></ext:GridCommand>
                        <Command Handler="handleCommand(command, record.data.ID);" />
                    <LoadMask Msg="Loading Nav Bar..." ShowMask="true" />
    Last edited by Daniil; Nov 01, 2010 at 7:08 PM. Reason: [CLOSED]
  2. #2

    RE: [CLOSED] Binding Store to Datatable VERY slow...


    It is no difference using SqlDataSource or bind grid with data directly (without DataSource control). The binding performs on client side therefore doesn't mater what source because data serialized to json object.

    I noticed that you use CommandColumn. CommandColumn is heavy control because it creates toolbar for each row therefore data rendering can be long for 100 rows if you use CommandColumn. 

    I recommend using it for a table with the number of lines of no more than 20.

    Otherwise use ImageCommandColumn - a simpler and faster version of CommanColumn
  3. #3

    RE: [CLOSED] Binding Store to Datatable VERY slow...

    Can you post a quick example of the image command column? I don't see where to set the image or the command name... Thanks
  4. #4

    RE: [CLOSED] Binding Store to Datatable VERY slow...


    Please see example in SVN 
    Coolite.Examples\Examples\GridPanel\Commands\Image _Command\ 
  5. #5

    RE: [CLOSED] Binding Store to Datatable VERY slow...

    Thanks, please mark as [CLOSED]...

  6. #6

    Alternative for MenuCommand but faster, not ImageCommand


    I use MenuCommand in my BufferView.

    Still, rendering is slow. I read the MenuCommand is heavy control and you propose to use ImageColumn.

    However, I have a lot of Command inside the menu, and converting them to image, will take 50% with of my grid.

    Will you improve performance rendering of MenuCommand ?

  7. #7

    Are you sure that it is MenuCommand the performance issue? You use BufferView therefore it should be very slow. If you remove commands then performance much better?
  8. #8

    There is Shared property for Menu. In this case one instance of menu will be used for all rows. I reccomnd to use it if your menu the same for all rows. It can improve performance

Similar Threads

  1. Replies: 1
    Last Post: Jun 26, 2012, 1:40 PM
  2. Datatable and Store columns mapping
    By QualityCode in forum 1.x Help
    Replies: 0
    Last Post: Dec 16, 2010, 8:45 PM
  3. Creating Store from Datatable
    By QualityCode in forum 1.x Help
    Replies: 2
    Last Post: Dec 13, 2010, 5:20 AM
  4. Replies: 3
    Last Post: Nov 30, 2010, 11:07 AM
  5. Replies: 6
    Last Post: Dec 20, 2008, 4:35 AM

Posting Permissions