Skip to content

Infragistics Community Forum / Web / Ignite UI for jQuery / Cannot call methods on igEditor prior to initialization

Cannot call methods on igEditor prior to initialization

New Discussion
Pete Davis
Pete Davis asked on Aug 22, 2018 1:43 PM

I’m handling the editRowStarted event in a grid and I want to hide the editor for a column if the row is being edited, but when it’s added I want it to show.

if (ui.rowAdding === false) {
$TestSampleTypeColumnManager.$_itemGrid.igGridUpdating(‘editorForKey’, $FSQATestSampleTypeColumnItem.fielD_TESTSAMPLETYPEID).igEditor(‘hide’);
}
else {
$TestSampleTypeColumnManager.$_itemGrid.igGridUpdating(‘editorForKey’, $FSQATestSampleTypeColumnItem.fielD_TESTSAMPLETYPEID).igEditor(‘show’);
}

When the “show” or “hide” get called, I get the error:
Uncaught Error: cannot call methods on igEditor prior to initialization; attempted to call method ‘show’

What do I need to do to initialize the editor?

I do this in other grids and it normally works, so I’m obviously failing to do something in this grid that’s causing it to fail.

Sign In to post a reply

Replies

  • 0
    Vasil Pavlov
    Vasil Pavlov answered on Jul 30, 2018 11:21 AM

    Hello Pete,

     

    Thank you for posting in our forum.

     

    If this code works in other grids, the reason might be the missing initialization of the “Updating” feature itself for this particular grid – this could easily happen if the handler is being attached to an already initialized grid, instead of during the initialization. Please check if this is missing in your code:

    features: [

                           {

                               name: "Updating"

                           },

                           …some other features…

    }

     

    In case that doesn’t fix the problem, I would appreciate if you please provide some more details regarding the grid initialization configuration as well as the Ignite UI version being used when this behavior occurs.

     

    On a side note, another possible approach would be to disable the editor for a given column by handling the editCellStarting event: the Updating feature iterates over each cell in the row that is being currently edited and initializes the appropriate editors one by one. If a given column shouldn’t be editable, then just return false in this event and the respective editor wouldn’t get initialized (the event would get cancelled). Here is a sample so that you have an idea of how it would look like when written in code:

     

     

    
    
    
        Sample
        
        
        
    
    
        

     

    If you need any additional assistance, feel free to contact me.

    • 0
      Pete Davis
      Pete Davis answered on Aug 21, 2018 7:42 PM

      Sorry, I never got the notification that this message posted (our support agreement had expired, so I thought I was going to have to wait until we got it before I could post.).

      Thank you for your answer.

      Here's a specific testable example of it failing. I am using the "updating" feature as you can see. It succeeds on the "hide" but then fails on the "show":

      
      
      
          
          Grid Test
          
          
          
          
          
          
          
      
      
          

      Grid

      • 0
        Vasil Pavlov
        Vasil Pavlov answered on Aug 22, 2018 1:43 PM

        Hello Pete,

         

        I have made some modifications to the provided code sample so that the editors get created when a new row gets added, but when in edit mode only the combo gets initialized:

        • The primary key has to be valid in order for the “Updating” feature to work correctly. As your datasource has only 2 properties for each record and one of them is the same for all records – I have chosen SampleId for a primaryKey
        • I have removed the “Index” column definition from the “columns” array as it tries to bind to a non-existent key – Index.
        • The PartId dataType has been changed to “number” and the “format: combobox” has been removed (because the igGrid doesn't support such format)
        • I have removed the editRowStarted event handler and handled editCellStarting instead.
        • Please note that grid = $("#grid").igGrid(gridOptions); would initialize the grid, but would also create implied global variable, which is not recommended as it pollutes the global scope and might lead to naming collisions. I have dropped the “grid =” and have just initialized the igGrid with $("#grid").igGrid(gridOptions);

        
        
        
            Grid Test
            
            
            
          
        
        
            

        Grid

         

        If you need any additional assistance, feel free to contact me.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Pete Davis
Favorites
0
Replies
3
Created On
Aug 22, 2018
Last Post
7 years, 6 months ago

Suggested Discussions

Created by

Created on

Aug 22, 2018 1:43 PM

Last activity on

Feb 25, 2026 9:16 AM