Returning value from DirectMethod for Column Renderer

Page 1 of 3 123 LastLast
  1. #1

    Returning value from DirectMethod for Column Renderer

    Dear All,

    I want to return a value from the DirectMethod to the Column Renderer function.

    As the DirectMethod is async so the method exits before value is returned from the server.

    Here is a sample code of what i want to achieve:
        var metterRenderer = function (value) {
            Ext.net.DirectMethods.GetComboValue(value, {
                success: function (result) {
                    return result;
                }
            });
        };
    Can you please tell me how to achieve this.

    Regards,
    Huzefa
    Last edited by Daniil; Nov 06, 2013 at 9:26 AM.
  2. #2
    Hi,

    A Renderer must run client side and the return value of the Renderer must return at the instance of its calling. The slower your Renderer, the slower the GridPanel will take to render. Calling an async DirectMethod is not supported.

    Hope this helps.
    Geoffrey McGill
    Founder
  3. #3
    Hi Geoffrey,

    Could you explain what you are saying with a small code sample? I am not getting the thing that you have explained.
    The server side method is called only after the renderer has finished returning the value;

    Also, how could I make the grid load nd then the renderer to run asynchronous nd not stop the rendering of the grid, this way even If the DirectMethod is slow then it wouldn't effect so much.


    Regards,
    Huzefa
    Last edited by huzzy143; Jan 05, 2012 at 5:05 PM.
  4. #4
    This is what i have done after you reply but doesn't seem to work.

    var metterRenderer = function (value) {
            var result = Ext.net.DirectMethods.GetComboValue('Hello', 'How are');
            return result;
        };
    Please help me out...
  5. #5
    Once again, you cannot call a DirectMethod within a Renderer. It will not work, and is not supported. The manipulation of the data record within the Renderer must be performed client-side.
    Geoffrey McGill
    Founder
  6. #6
    Ok Geoffrey.

    With that said. I have a situation where in I have a DropdownField as the editor of the Grid.
    This Dropdownfield is populated with data only when the user clicks the dropdown trigger. Meaning its late bound.

    Now when the user saves the entered data in the grid, then I display back the grid for editing purpose,
    At that time the dropdownfield column just display the ID field of the dropdown as that is DataIndex for the grid.

    This is also the problem when user selects the data from dropdown and the dropdown column exits from edit mode.
    Once the user moves to another column after selecting a value. Then only ID is shown and not the DisplayField.

    The user doesn't understand the ID, I need to show them the display field of the Dropdown.

    How can I achieve this? Remember the data is late bound. Data is not available on the client side.

    Regards,
    Huzefa
  7. #7
    Any idea how can i achieve?? I am very clueless on this..
  8. #8
    You should bind a grid with a respective data form a server side, like this:
    https://examples1.ext.net/#/GridPane...d/Remote_Load/
  9. #9
    I do not want to load whole data from server side.
    I just want the DisplayField to be loaded for each DropField Column.

    Suppose I have class like this
    Public class Car{
       public int TyreId {get; set;}
       public string Name {get; set;}
       public string Description {get; set;}
    }
    Now I will bind the list of this Car object to grid.
    And have a dropdownfield for TyreId column so that user can select from available value.
    This dropdownfield is late bound so that initial page loaf does not take time.

    Now when user saves the record after entering the data, I should get the TyreId properly.
    But when I display back the record for user to make edition I want the DisplayField to be bound instead of ID field in TyreId column.

    Now I think AfterRender would be a place where I can loop through each record and column.
    And get the DisplayField for TyreId through DirectMethod or Ajax.

    But I am wondering how would I set the DisplayField to TyreId column using JavaScript in AfterRender Listner?
    Please helpe out with this.
  10. #10
    To set up a Column's rendered via JavaScript on the fly, you could use the ColumnModel's setRenderer method.
    http://docs.sencha.com/ext-js/3-4/#!...od-setRenderer

    Though I'm not sure it will help you.

    Thanks for the detailed description, but I'm afraid I've not got your requirement well.

    Please provide a full, but simplified, sample which would demonstrate the requirement.
Page 1 of 3 123 LastLast

Similar Threads

  1. Setting and returning value on checkbox
    By HexElffilter in forum 1.x Help
    Replies: 0
    Last Post: Feb 14, 2012, 8:39 AM
  2. DirectMethod returning a boolean
    By mark39 in forum 1.x Help
    Replies: 2
    Last Post: Dec 15, 2011, 11:46 AM
  3. Replies: 1
    Last Post: Sep 13, 2011, 5:19 PM
  4. [CLOSED] Difference between DirectMethod , DirectEvent, Static DirectMethod
    By syllabusarq in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 01, 2011, 11:37 AM
  5. [CLOSED] Reach Command coloumn at run time with javascript
    By farisqadadeh in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 10, 2010, 5:40 AM

Tags for this Thread

Posting Permissions