[CLOSED] How to cancel rowselection in grid panel

  1. #1

    [CLOSED] How to cancel rowselection in grid panel

    I have a gridpanel that bind to a formpanel.

    Every time user select other row of gridpanel, I will update the record of the formpanel to the current row of the grid.

    I want to add some checking in the "BeforeDeselect" directevent and if the checking not pass, then cancel the deselect event.

                                        <DirectEvents>
                                            <BeforeDeselect OnEvent="tblDetail_BeforeDeselect" />
                                        </DirectEvents>
            protected void tblDetail_BeforeDeselect(object sender, DirectEventArgs e)
            {
                //do checking here
            }
    This problem is DirectEventArgs don't have a parameter cancel. How can I cancel the event in this case?

    Actually, I have tried to do this by listener and do the checking by DirectMethod.

                                            <BeforeDeselect Handler="
                                                App.direct.chkGridRow();
                                                //chkGridRow will set hidRowChkFlg to 1 if checking not pass
                                                if(#{hidRowChkFlg).getValue() == 1)
                                                    return false;
                                                                                                                                        
                                                var grid = #{tblDetail}, form = #{pnlDetail};
                                               form.getForm().updateRecord(form.record);
                                                grid.store.sync();
                                                                      " />
    However the value of hidRowChkFlg will not change immediately in client side and just effective after the BeforeDeselect event finished.

    Can give me any suggestion how to do the checking?
    Last edited by Daniil; Mar 21, 2014 at 12:24 PM. Reason: [CLOSED]
  2. #2
    Hi @trePjt,

    Deselecting occurs synchronously, but a DirectEvent/DirectMethod occurs asynchronously.

    It means that there is no way to cancel it during a DirectEvent/DirectMethod.

    You can cancel the event in a BeforeDeselect listener (return false from a listener), then in the tblDetail_BeforeDeselect if a row is allowed to be deselected, then deselect it programmatically.
  3. #3
    Hi Daniil,

    Actually, I have tried to use listener like this

    <BeforeDeselect Handler="
        App.direct.chkGridRow();
        //chkGridRow will set hidRowChkFlg to 1 if checking not pass
        if(#{hidRowChkFlg).getValue() == 1)
            return false;
                                                                                                 
        var grid = #{tblDetail}, form = #{pnlDetail};
       form.getForm().updateRecord(form.record);
        grid.store.sync();
                              " />
    However the value of hidRowChkFlg will not change immediately in client side and just effective after the BeforeDeselect event finished.

    Are there any solutions to have server side checking in the listener?
  4. #4
    However the value of hidRowChkFlg will not change immediately in client side and just effective after the BeforeDeselect event finished.
    Exactly.

    Are there any solutions to have server side checking in the listener?
    No, there are not.

Similar Threads

  1. [CLOSED] how to stop rowselection when the command button is clicked in grid ?
    By legaldiscovery in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 22, 2013, 11:31 AM
  2. [CLOSED] Grid RowSelection w/HyperLinks: IgnoreTargets not working.
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 18, 2011, 9:38 PM
  3. [CLOSED] Rowselection is executed when Selecting a Grid cell
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 09, 2011, 9:13 AM
  4. Cancel RowSelection
    By rthiney in forum 1.x Help
    Replies: 0
    Last Post: Oct 12, 2009, 4:28 PM
  5. [CLOSED] Ordering grid column with RowSelection
    By tansu in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 26, 2009, 3:29 AM

Posting Permissions