1. #1
    Ext User
    Join Date
    Nov 2010
    Posts
    3
    Vote Rating
    0
    Almedson Ferreira is on a distinguished road

      0  

    Question CheckBox Event on MenuItem of the Header Grid

    CheckBox Event on MenuItem of the Header Grid


    Hi,

    I have a problem and I need help.
    For example, I need to get the CheckBox object that is on MenuItem on the Grid Header.
    On the grid header has a menu with 3 options: Sort Ascending, Sort Descending and Columns.
    Choosing columns, open other menu with the CheckBox for each column where we can hiden or show the column in the grid. I need to get this CheckBox object or MenuItem object to add event on it.

    Can somebody here in this forum help me?

    Thanks for your help,

    - Almedson

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    What do you want to do? There is an event fired on sort and also on hidding a column. Cannot you better listen to that events?

  3. #3
    Ext User
    Join Date
    Nov 2010
    Posts
    3
    Vote Rating
    0
    Almedson Ferreira is on a distinguished road

      0  

    Default


    In the class com.extjs.gxt.ui.client.widget.grid.GridView.class I put a break point at line 803. I need to get the CheckMenuItem object to add a new event with addListener();

    The GridView code is:
    protected Menu createContextMenu(final int colIndex) {
    final Menu menu = new Menu();

    if (cm.isSortable(colIndex)) {
    MenuItem item = new MenuItem();
    item.setText(GXT.MESSAGES.gridView_sortAscText());
    item.setIcon(getImages().getSortAsc());
    item.addSelectionListener(new SelectionListener<MenuEvent>() {
    public void componentSelected(MenuEvent ce) {
    doSort(colIndex, SortDir.ASC);
    }

    });
    menu.add(item);

    item = new MenuItem();
    item.setText(GXT.MESSAGES.gridView_sortDescText());
    item.setIcon(getImages().getSortDesc());
    item.addSelectionListener(new SelectionListener<MenuEvent>() {
    public void componentSelected(MenuEvent ce) {
    doSort(colIndex, SortDir.DESC);
    }
    });
    menu.add(item);
    }

    MenuItem columns = new MenuItem();
    columns.setText(GXT.MESSAGES.gridView_columnsText());
    columns.setIcon(getImages().getColumns());
    columns.setData("gxt-columns", "true");

    final Menu columnMenu = new Menu();

    int cols = cm.getColumnCount();
    for (int i = 0; i < cols; i++) {
    if (shouldNotCount(i, false)) {
    continue;
    }
    final int fcol = i;
    797 final CheckMenuItem check = new CheckMenuItem(); //I need to get this object CheckMenuItem
    check.setHideOnClick(false);
    check.setText(cm.getColumnHeader(i));
    check.setChecked(!cm.isHidden(i));
    check.addSelectionListener(new SelectionListener<MenuEvent>() {
    public void componentSelected(MenuEvent ce) {
    803 cm.setHidden(fcol, !cm.isHidden(fcol)); //Break point here
    804 restrictMenu(columnMenu);

    }
    });
    columnMenu.add(check);
    }

    restrictMenu(columnMenu);

    columns.setSubMenu(columnMenu);
    menu.add(columns);
    return menu;
    }



    I've tried all forms and no result:
    Grid grid = getGrid();
    grid.getView().getHeader().getContextMenu();
    grid.getView().getHeader().getContextMenu().getParentItem();
    grid.getView().getHeader().getContainer().getContextMenu().getContextMenu().getWidget(1);
    grid.getView().getHeader().getContainer().getContextMenu();

    Can you help me?

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    You have not erally answered my question. So you want to know when a column gets hidden/shown. Is that correct?

  5. #5
    Ext User
    Join Date
    Nov 2010
    Posts
    3
    Vote Rating
    0
    Almedson Ferreira is on a distinguished road

      0  

    Default


    No, I can do this, to verify if a column is hidden or not and change, but what I really need to know is how can I add a event writen by me. So when that native event is run, my event is run too without override the native event.

Similar Threads

  1. CheckBox MenuItem AutoRef issue
    By parky128 in forum Ext Designer: Help & Discussion
    Replies: 1
    Last Post: 27 Oct 2010, 6:11 AM
  2. MenuItem Event
    By rizla in forum Ext GWT: Help & Discussion (1.x)
    Replies: 12
    Last Post: 10 Oct 2010, 2:28 AM
  3. Menuitem Checkbox
    By mihaip007 in forum Ext Designer: Help & Discussion
    Replies: 3
    Last Post: 30 Aug 2010, 9:20 PM
  4. menuItem and event :(
    By rizla in forum Ext GWT: Help & Discussion (1.x)
    Replies: 2
    Last Post: 3 Aug 2009, 3:53 AM

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar