Disable a gridcolumn and its datarow

Page 1 of 2 12 LastLast
  1. #1

    Disable a gridcolumn and its datarow

    Hello Ext.net team,
    I want to disable a gridcolumn and i find the [column].setDisable(true) function, but it only disable a header of column.
    I want to disable column's row, not it's header.
    Have any solution to do that?
    Thank for your help.
  2. #2
    Hi @vietdv,

    Please elaborate on what you exactly mean by disabling of a column's row.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @vietdv,

    Please elaborate on what you exactly mean by disabling of a column's row.
    Hi Daniil,
    Thank you for fast reply,
    My case is that i have a form with 2 modes: VIEW and EDIT. And they have multi controls in it (textfield, combobox, datefield, and gridpanel,etc...).
    The grid has 2 Command columns:
    1 is Download to download the attachment
    2 is Edit and delete to modify the data row
    In VIEW mode user can only view the content, can DOWNLOAD but CAN NOT Edit and Delete row in gridpanel.
    In EDIT mode user can edit in all control include edit/delete datarow in GridPanel.
    I have solution to set readonly, disable control using Ext.ComponentQuery.query.
    But if i find Ext.ComponentQuery.query('gridpanel') and use [gridpanel].setDisabled(true) then i can not catch my target, so i use Ext.ComponentQuery.query('gridcolumn') and use [gridcolumn].setDisabled(true) it only disable the header row.
    Have you got any solution for me?
  4. #4
    Thank you for the explanation.

    What feature do you use to edit? CellEditing/RowEditing plugins or a ComponentColumn?

    2 is Edit and delete to modify the data row
    What about hiding that CommandColumn at all?
  5. #5
    Quote Originally Posted by Daniil View Post
    Thank you for the explanation.

    What feature do you use to edit? CellEditing/RowEditing plugins or a ComponentColumn?



    What about hiding that CommandColumn at all?
    Hi Daniil,
    Thanks for your fast reply again.
    I use plugin to enable user can edit direct in the gridpanel.
    In my case, i wont want to hide that column.
    And [gridcolumn].setDisabled(true) really not work as i wanted, not only with command columns, i want to set disable ext:column too.
  6. #6
    To disable editing, please return false from an Editing plugin's BeforeEdit client side listener.
    <ext:CellEditing runat="server">
        <Listeners>
            <BeforeEdit Handler="return false; // or true if editing is allower" />
        </Listeners>
    </ext:CellEditing>
    To disable commands in a CommandColumn, please use its PrepareToolbar.
    https://examples2.ext.net/#/GridPane...epare_Toolbar/
  7. #7
    Quote Originally Posted by Daniil View Post
    To disable editing, please return false from an Editing plugin's BeforeEdit client side listener.
    <ext:CellEditing runat="server">
        <Listeners>
            <BeforeEdit Handler="return false; // or true if editing is allower" />
        </Listeners>
    </ext:CellEditing>
    To disable commands in a CommandColumn, please use its PrepareToolbar.
    https://examples2.ext.net/#/GridPane...epare_Toolbar/
    hmm...
    Your solution does not work for me, because of 2 reasons:
    1: My grid has it own Listeners/BeforeEdit. If i use BeforeEdit event when i change from EDIT mode to VIEW mode, i will not add right listener when i change mode back.
    2: Your sample to disable commands only work 1 time when prepare. I want disable and enable any time i needed.
  8. #8
    Quote Originally Posted by vietdv View Post
    1: My grid has it own Listeners/BeforeEdit. If i use BeforeEdit event when i change from EDIT mode to VIEW mode, i will not add right listener when i change mode back.
    I don't think you need to change a BeforeEdit listener. You can return from a BeforeEdit some JavaScript variable and change just that variable, not the entire listener.


    Quote Originally Posted by vietdv View Post
    2: Your sample to disable commands only work 1 time when prepare. I want disable and enable any time i needed.
    A PrepareToolbar is executed on each refresh of GridPanel. You can force refreshing by:
    App.GridPanel1.getView().refresh();
  9. #9
    Quote Originally Posted by Daniil View Post
    I don't think you need to change a BeforeEdit listener. You can return from a BeforeEdit some JavaScript variable and change just that variable, not the entire listener.




    A PrepareToolbar is executed on each refresh of GridPanel. You can force refreshing by:
    App.GridPanel1.getView().refresh();
    the
    [gridpanel].getView().refresh()
    seem like it'll take alot of perfomance.
    but your solution works now. Thank you for your help.
    Last edited by Daniil; Jun 11, 2014 at 2:34 PM. Reason: Please use [CODE] tags
  10. #10
    Yes, a refresh call re-renders the entire GridPanel.

    You can try to update a specific row by a refreshNode call on a GridPanel's view.
    http://docs.sencha.com/extjs/4.2.1/#...od-refreshNode
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 3
    Last Post: Jan 24, 2014, 3:30 PM
  2. [CLOSED] Sorting Gridcolumn with isComplex=true
    By mirwais in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 26, 2013, 1:32 PM
  3. [CLOSED] Modify content of gridcolumn
    By pmnicaragua in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 26, 2013, 2:41 PM
  4. Replies: 0
    Last Post: Feb 28, 2012, 2:15 PM
  5. DataRow from GridPanel Store
    By ven in forum 1.x Help
    Replies: 0
    Last Post: Jun 21, 2011, 11:18 AM

Posting Permissions