Grid Selected RowIndex -1 after some row

  1. #1

    Grid Selected RowIndex -1 after some row


    I have a problem on using Checked Grid.
    Here is my grid and a button for counting checked data.
                        <ext:Model runat="server">
                                <ext:ModelField Name="name" />
                    <ext:Column runat="server" Text="Name" DataIndex="name" Flex="1" />
                <ext:CheckboxSelectionModel runat="server" Mode="Multi" />
                                <Click OnEvent="BtnCheck_Click" />
    I fill the grid with 100 data with this code in Page Load event.
            If Not Ext.Net.X.IsAjaxRequest Then
                Dim testData As New List(Of Object())
                For i As Integer = 1 To 100
                    testData.Add(New Object() {"Test Data " & i})
                storeTest.DataSource = testData.ToArray()
            End If
    As I mention before, I have a button to counting Checked data.
    Here is my code to count the checked data.
        Protected Sub BtnCheck_Click(sender As Object, e As DirectEventArgs)
            Dim sm As RowSelectionModel = gridTest.GetSelectionModel()
            Dim counter As Integer = 0
            Dim counterAll As Integer = 0
            For Each selected As SelectedRow In sm.SelectedRows
                If selected.RowIndex >= 0 Then
                    counter = counter + 1
                End If
                counterAll = counterAll + 1
            Ext.Net.X.Msg.Alert("Total Selected", counter & " Check Counted, " & counterAll & " All Checked").Show()
        End Sub
    The problem is, when checked all, even though the data is 100, counterAll is equal to 100 but counter is equal to 53 (maybe different). The Rest of the selected data is not counted because selected.RowIndex equal to -1.
    But this only happen when check all using CTRL+A or check checkbox beside header column. When checking one by one, it works perfectly.

    Click image for larger version. 

Name:	Problem.PNG 
Views:	8 
Size:	28.1 KB 
ID:	24837

    Any idea why this is happen?
    Last edited by Kuro13; Feb 07, 2017 at 4:27 AM.

Similar Threads

  1. How to get rowindex of a gridpanel in JS
    By arjunrvasisht in forum 2.x Help
    Replies: 1
    Last Post: Jan 02, 2015, 4:12 PM
  2. [CLOSED] Selected rowindex is not updated after drag and drop in grid
    By profitsistemas in forum 2.x Premium Help
    Replies: 9
    Last Post: Feb 07, 2013, 5:03 AM
  3. [CLOSED] Get the rowIndex of the selected row
    By 78fede78 in forum 1.x Premium Help
    Replies: 1
    Last Post: Jan 21, 2011, 1:44 PM
  4. [CLOSED] get rowindex for grid
    By idrissb in forum 1.x Premium Help
    Replies: 2
    Last Post: Feb 09, 2010, 4:20 PM
  5. rowIndex in GetRowClass - possible?
    By Tbaseflug in forum 1.x Help
    Replies: 2
    Last Post: Sep 23, 2009, 11:25 PM

Tags for this Thread

Posting Permissions