[CLOSED] How to get column header name on grid panel cell's right click

  1. #1

    [CLOSED] How to get column header name on grid panel cell's right click

    I am creating a grid panel dynamically. While creating am locking the first 3 columns. So that the horizontal scroll bar starts from the 4th column. I have context menu implemented for the grid which should not be enabled for the locked columns. I have an event written inside the view config of a grid like below to prevent the right click:

      <ViewConfig>
                    <Listeners>
                        <CellContextMenu Fn="preventRightClick" />
                    </Listeners>
                </ViewConfig>
    Function definition:
     preventRightClick =  function (view, td, cellIndex, record, tr, rowIndex, e){
                      
                       var abc = #{grdETSummary};
                       #{HdnColumnIndex}.setValue(cellIndex);
                       if((cellIndex == "0")||(cellIndex == "1")||(cellIndex == "2"))
                       {
                           #{tier1SummaryMenu}.disable();
                           #{tier2SummaryMenu}.disable();
                       }
                       else
                       {
                            #{tier1SummaryMenu}.enable();
                           #{tier2SummaryMenu}.enable();
                       }
                    
                       e.preventDefault();
                   }
    The problem is after locking the first 3 (0,1,2) columns, the column index of the 4th column in the javascript function again starts from 0 instead of starting from 3. So as per my grid, the columns 3,4,5 also disables the context menu. If I can get the column header name in the click event then I can restrict it from being disabled. Please tell me how do I get the column header name WITHOUT USING THE COLUMN INDEX.!! Well, if I had to use the column index to find the column header again it results in the same way as the unlocked column index starts from 0.
    Last edited by Daniil; May 26, 2015 at 4:50 PM. Reason: [CLOSED]
  2. #2
    Hi arjunrvasisht

    Does
    view.panel.columns;
    return all columns including locked and unlocked?
    Last edited by EnZo; May 18, 2015 at 12:21 PM.
  3. #3
    Hi EnZo,

    It returns only unlocked columns.
  4. #4
    Hi Arjun,

    when you work with locked columns, then in that case you have different view ids for locked and unlocked columns, try to check "view.id" and enable/disable context menu in your preventRightClick function.

    Regards,
    Prasoon
  5. #5
    Thanks Prasoon :)
    I will give a try right now..! It should work.

Similar Threads

  1. Replies: 0
    Last Post: May 12, 2012, 11:24 AM
  2. Grid panel column header localization
    By reezvi in forum 1.x Help
    Replies: 5
    Last Post: Aug 08, 2011, 9:57 AM
  3. Replies: 16
    Last Post: Feb 23, 2011, 10:03 AM
  4. [CLOSED] [1.0] Centralize Column Header Grid Panel
    By pdcase in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 01, 2010, 9:20 PM
  5. Replies: 8
    Last Post: May 17, 2010, 11:11 AM

Posting Permissions