[CLOSED] GridPanel, SelectedRow and RowSelectionModel : Is JsonReader required to get selected row in server code?

  1. #1

    [CLOSED] GridPanel, SelectedRow and RowSelectionModel : Is JsonReader required to get selected row in server code?

    Hey,
    I have previously used the following code to get the selected row on the server side:

    RowSelectionModel sm = GridPanel2.SelectionModel.Primary as RowSelectionModel;
    
                if (sm.SelectedRow != null)
                {
                      // do something
                }
    In that case the store for GridPanel2 uses a JsonReader. If I use the same code, but instead of a JsonReader for the Store I use an ArrayReader, it wont work:

              <ext:Store ID="Store1" runat="server">
                                                <Reader >
                                                    <ext:ArrayReader IDProperty="Nbr">
                                                        <Fields>
                                                            <ext:RecordField Name="Nbr"></ext:RecordField>
                                                            <ext:RecordField Name="Stuff"></ext:RecordField>
                                                        </Fields>
                                                    </ext:ArrayReader>
                                                </Reader>
                                            </ext:Store>
    I just want to confirm that I cannot use the server side code as specified aboive if I do not use a JsonReader for the Store?

    Is there any way of getting the selected row in a GridPanel when using an ArrayReader?
    Last edited by Daniil; Apr 09, 2011 at 12:55 PM. Reason: [CLOSED]
  2. #2
    No, JsonReader is not required as I see it. I realize that I have an ArrayReader for another GridPanel, and I can select a row and in teh server code get the correct row.

    Problem is, I cannot get it to work on this GridPanel Im on now for some reason.

    <ext:GridPanel ID="GridPanel_solutions" runat="server" Height="150" Title="Test" >
                                        <Store>
                                            <ext:Store ID="Store_BookingResults_Solutions" runat="server" AutoDataBind="true" AutoLoad="true" OnRefreshData="TestABC">
                                                <Reader >
                                                    <ext:JsonReader IDProperty="Nbr">
                                                        <Fields>
                                                            <ext:RecordField Name="Nbr"></ext:RecordField>
                                                            <ext:RecordField Name="Score"></ext:RecordField>
                                                        </Fields>
                                                    </ext:JsonReader>
                                                </Reader>
                                            </ext:Store>
                                        </Store>
    
                                        <ColumnModel ID="ColumnModel2" runat="server">
                                            <Columns>
                                                <ext:Column ColumnID="Nbr" DataIndex="Nbr" Header="Nbr" Hidden="true"/>
                                                <ext:Column DataIndex="Score" Header="PoƤng" Width="60"/>
                                            </Columns>
                                        </ColumnModel>
                                        <SelectionModel>
                                            <ext:RowSelectionModel
                                                ID="SelectedRowModel1" 
                                                runat="server" 
                                                SingleSelect="true">
                                                <Listeners>
                                                    <RowSelect Handler="Ext.net.DirectMethods.SolutionSelected()" />
                                                </Listeners>
                                            </ext:RowSelectionModel>
                                        </SelectionModel>
                                    </ext:GridPanel>
    code behind:

     [DirectMethod]
            public void SolutionSelected()
            {
                RowSelectionModel sm = GridPanel_solutions.SelectionModel.Primary as RowSelectionModel;
    
                if (sm.SelectedRow != null) // sm.SelectedRow is always null
                {
                    // do something
                }
               
            }
    What am I missing this time?
  3. #3
    Hi,

    Yes, selections don't deal with Store and, respectively, Reader.

    Is the rest part of this thread totally related to the following thread?
    http://forums.ext.net/showthread.php?13152
  4. #4
    yes, it is!

    It was a late night, I had several things that was messing with me so I guess I sort of double-posted. Im sorry about that.

    the Delay="1" works.

    But its odd since the Delay="1" was not needed in another GridPanel/RowClick in the same project. There it just is like this:
    <Listeners>
         <RowClick Handler="Ext.net.DirectMethods.SetCustomer();"    />
    </Listeners>
    and it works. Why is that?
  5. #5
    Well, it's odd. Is the rest part of configuration the same? I guess - no.

    Please provide a sample to reproduce where it works without Delay="1".
  6. #6

    Moving row from one gridpanel to another

    Hi,
    I want to move a selected row data to another grid but alwys am getting record undefined.
    Plz help me its very urgent
    Thanks in advance
  7. #7
    Hi,

    Please start a new forum thread.

Similar Threads

  1. Replies: 1
    Last Post: Mar 11, 2012, 3:03 AM
  2. Replies: 2
    Last Post: Oct 31, 2011, 5:31 AM
  3. Replies: 3
    Last Post: Oct 21, 2011, 4:35 AM
  4. [CLOSED] GridPanel : SelectedRow is always NULL?
    By wagger in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 06, 2011, 4:46 AM
  5. Replies: 1
    Last Post: Oct 30, 2008, 5:57 AM

Tags for this Thread

Posting Permissions