[CLOSED] Client side error databinding Store

  1. #1

    [CLOSED] Client side error databinding Store

    Hi,

    I'm receiving a JS error when data binding a Store on the server. The error is thrown when a typed DataTable doesn't contain any records. There's no error when at least one row is present in the data source. I'm not sure where to look for clues or pointers. A nearly identical set up works for me with no issues whatsoever. Please advise if more info is required here. Click image for larger version. 

Name:	Error.JPG 
Views:	10 
Size:	96.5 KB 
ID:	6577

            protected void Page_Load(object sender, EventArgs e)
            {
                if (ExtNet.IsAjaxRequest) return;
    
                var dataSource=GetTypedDataTable();
                this.Store1.DataSource = dataSource;
                this.Store1.DataBind();
            }
                    <Store>
                        <ext:Store runat="server" ID="Store1" PageSize="20">
                            <Model>
                                <ext:Model ID="Model1" runat="server" IDProperty="ID">
                                    <Fields>
                                        <ext:ModelField Name="ID" Type="Int" />
                                        <ext:ModelField Name="Message" Type="String" />
                                        <ext:ModelField Name="CreatedDate" Type="Date" RenderMilliseconds="true" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                            <Sorters>
                                <ext:DataSorter Property="CreatedDate" Direction="DESC" />
                            </Sorters>
                        </ext:Store>
                    </Store>
    Last edited by Daniil; Jul 19, 2013 at 5:13 PM. Reason: [CLOSED]
  2. #2
    I've figured it out. The call causing the error was on my side:

            var selectedValues = grid.getRowsValues({
                currentPageOnly: true,
                selectedOnly: true
            });
    
            var sm = grid.getSelectionModel();
            if (sm && selectedValues.length == 0) {
                grid.getSelectionModel().selectRange(0, 0);   // Error was thrown here
            }
    With no records in the Store, selectRange(0, 0) would fail producing the error description that kept me puzzled for a while. I've augmented the check in my code to avoid it as below:

            var selectedValues = grid.getRowsValues({
                currentPageOnly: true,
                selectedOnly: true
            });
    
            var sm = grid.getSelectionModel();
            if (sm && selectedValues.length == 0 && grid.getStore().count()!=0) {
                grid.getSelectionModel().selectRange(0, 0);
            }
    You can mark this question as closed.

Similar Threads

  1. Replies: 9
    Last Post: Oct 16, 2012, 12:05 AM
  2. [CLOSED] 2.x Query from Store on Client Side
    By omazlov in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Sep 07, 2012, 5:40 PM
  3. Replies: 3
    Last Post: Dec 26, 2011, 1:32 PM
  4. [CLOSED] Dynamic Store: undefined error at client side
    By digitek in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 16, 2011, 10:17 AM
  5. Replies: 1
    Last Post: Dec 01, 2010, 5:14 PM

Tags for this Thread

Posting Permissions