[CLOSED] Programatically start editing and set value of editor

  1. #1

    [CLOSED] Programatically start editing and set value of editor

    Currently I have a grid with command that executes an Ajax Method. When the Ajax Method returns the value I want to start editing the grid and update the editor to the value returned by the Ajax Method.

    Here is the javascript that is used to handle the command.

    function HandleCommands(command, record) {
    
       var value = Coolite.AjaxMethods.GetValue(record.id);
                        
       var recordRowIndex = #{GridPanel}.store.indexOf(record);
                        
       #{GridPanel}.getColumnModel().getCellEditor(1,recordRowIndex).setValue(value);
    
       #{GridPanel}.startEditing(recordRowIndex, 1);
    
    }
    The editor is set to the correct value however when editor is activated the new value isn't there. Is there another function that I should use?

    Is there a way to edit the record in the store directly without using an editor?

    Thanks.
  2. #2

    RE: [CLOSED] Programatically start editing and set value of editor

    Hi,

    1. AjaxMethod calling is async operation therefore it cannot return value. You have to use success handler to perform required actions

    2. To edit record use 'set' method - record.set(dataIndex, value)

    function HandleCommands(command, record) {
       Coolite.AjaxMethods.GetValue(record.id, {
            success: function(value){
                var recordRowIndex = #{GridPanel}.store.indexOf(record);     
                record.set(put_here_required_dataindex, value);
                #{GridPanel}.startEditing(recordRowIndex, 1);
            }
       });                    
    }

Similar Threads

  1. [CLOSED] GridPanel.start cell editing when key pressed
    By supera in forum 2.x Legacy Premium Help
    Replies: 10
    Last Post: Mar 01, 2012, 7:04 PM
  2. [CLOSED] How to close a ContextMenu programatically
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 26, 2012, 9:17 PM
  3. GridPanel Editor :- Stop editing on enter key
    By vivekrane1986 in forum 1.x Help
    Replies: 2
    Last Post: Oct 22, 2010, 9:50 AM
  4. Replies: 0
    Last Post: Feb 12, 2009, 6:38 AM
  5. [CLOSED] Select TreeNode Programatically
    By Ben in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 04, 2009, 9:45 AM

Posting Permissions