[CLOSED] select grid rows with ajax handler

  1. #1

    [CLOSED] select grid rows with ajax handler



    In the code at https://examples1.ext.net/#/GridPane...box_Selection/

    It demonstrates SELECTING rows in page load like this.....

    protected void Page_Load(object sender, EventArgs e)
     {
         if (!Ext.IsAjaxRequest)
         {
             if (!this.IsPostBack)
             {
                 RowSelectionModel sm = this.GridPanel1.SelectionModel.Primary as RowSelectionModel;
                 // SELECT A COUPLE OF ROWS 
                 sm.SelectedRows.Add(new SelectedRow(2));
                 sm.SelectedRows.Add(new SelectedRow(4));
             }
         }
    }
    But I can't make this SELECTION work in an ajax handler method. (No error, just no selection.)

    protected void Button2_Click(object sender, AjaxEventArgs e)
    {
        RowSelectionModel sm = this.GridPanel1.SelectionModel.Primary as RowSelectionModel;
        
        // .... BUT THIS DOESNT WORK FOR MANUALLY MAKING A SELECTION....
        sm.SelectedRows.Add(new SelectedRow(1));
        sm.SelectedRows.Add(new SelectedRow(5));
    }
    Any suggestions how I can make this work?

    Thanks, in advance.
  2. #2

    RE: [CLOSED] select grid rows with ajax handler


    ....I have the Page Load record selecting as demo'ed in the Coolite Example working properly. So I'm confident the grid itself is working as it should.
  3. #3

    RE: [CLOSED] select grid rows with ajax handler

    Hi,

    You have to call 'UpdateSelection' method of selection model during ajax event (call it after modifing SelectedRows collection)
  4. #4

    RE: [CLOSED] select grid rows with ajax handler



    PERFECT! Thanks.

Similar Threads

  1. [CLOSED] Is it possible to Select Items of a multi select during ajax event
    By vedagopal2004 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 29, 2010, 6:28 PM
  2. [CLOSED] select grid rows by checkbox selections
    By hillscottc in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 06, 2010, 7:17 PM
  3. Replies: 1
    Last Post: Mar 16, 2010, 3:58 PM
  4. Select rows in a Grid with a list of record Id
    By fquintero in forum 1.x Help
    Replies: 1
    Last Post: Dec 01, 2009, 4:14 PM
  5. Selectin Grid Rows and Delay Ajax Event
    By EzaBlade in forum 1.x Help
    Replies: 2
    Last Post: Jan 28, 2009, 8:06 AM

Posting Permissions