[CLOSED] Gridpanel ItemContextMenu Handler function not giving current rowindex for inserted row

  1. #1

    [CLOSED] Gridpanel ItemContextMenu Handler function not giving current rowindex for inserted row

    Hi

    following is the script for ItemContextMenu Handler function

     var onContextMenu = function (e, currentRecord, contextmenu) {
            rowindex = currentRecord.index;
    ...
    ...
    }
    And following is the function calling line

    Html.X().GridPanel()
    ...
    ...
    .Listeners(l =>
                            {
                                l.ItemContextMenu.Handler = "onContextMenu(e,this.store.getAt(index),#{ContextMenu})";                            
                            }
                    )
    There is another function on contextmenu item click which dynamically adds new row to the grid

    var onClick = function (ctrl, text) {
            if (text == "xyz") {
                // Create a model instance
    
                var storeData = ....;
                var r = Ext.create('Modelnm', storeData);
                var storeSt = Ext.getStore('Storenm');
                storeSt.insert(rowindex, r); 
                App.PriceEntryGrid.editingPlugin.startEditByPosition({ row: rowindex, column: 0 });
                return false;
            }

    The issue faced is when we do a rightclick on a dynamically added row we do not get the rowindex (it's shown as undefined).
    For existing rows / normal rows we get rowindex.
    Last edited by Daniil; Jul 12, 2013 at 5:16 AM. Reason: [CLOSED]
  2. #2
    Hi @PriceRightHTML5team,

    Currently, a record's index property is not a part of API. Please do not rely on this property.

    Use the "index" argument of the ItemContextMenu event like you use it in the getAt() call.
  3. #3
    Hi Daniil,
    Thanks "index" argument serves the purpose.

Similar Threads

  1. Replies: 3
    Last Post: Mar 06, 2013, 3:48 AM
  2. Replies: 7
    Last Post: Sep 26, 2012, 7:46 PM
  3. Replies: 1
    Last Post: Sep 28, 2011, 3:50 AM
  4. [CLOSED] How to get gridpanel's rowIndex in the example below?
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 25, 2011, 1:51 PM
  5. Replies: 1
    Last Post: Jul 30, 2009, 6:33 AM

Tags for this Thread

Posting Permissions