[CLOSED] TreeGrid update

  1. #1

    [CLOSED] TreeGrid update

    Hello,

    I would want to do the following but it doesn't work as expected.

    When I click a button a Ajax.request is sent to the server which returns a response in Json format. The response is in fact the content of my treegrid and I want to refresh the treeGrid with this response. I get the response correctly but unfortunately the treeGrid doesn't refresh.

    As follow is the diffrent code I use:

    The request is made with this ajax request

    Ext.Ajax.request({
    url: '<%= Url.Action("action", "controller") %>',
    method: 'POST',
    params: { data: data },
    success: function(p1, p2) {
    var nodes = eval(p1.responseText);
    if(nodes.length > 0){
    treeGrid.initChildren(nodes);
    }
    }
    });

    Here is the code of the action

    [AcceptVerbs(HttpVerbs.Post)]
    publicActionResult action(string data)
    {
     
    List<Dictionary<string, object>> dict = newList<Dictionary<string,object>>();
    dict.Add(newDictionary<string, object>() { { "dateApproval", "tester" }, { "leaf", true } });
     
    returnthis.Json(dict);
    }
    The TreeGrid is defined as follow

    <ext:TreeGridID="treeGrid"runat="server"Title="titre"
    AutoScroll="true"Height="200">
    <Columns>
    <ext:TreeGridColumnDataIndex="dateApproval"Width="200"/>
    </Columns>
    </ext:TreeGrid>
    What is going wrong in my code and what should be done the have the code behave as wished?

    Romuald.
    Last edited by geoffrey.mcgill; Jul 26, 2010 at 6:55 AM.
  2. #2
    Hi,

    In the action you have to use TreeNodeCollction and call ToJson method for serialization
    For example see the code of the http handler in the following example
    https://examples1.ext.net/#/TreePane...Using_Handler/

Similar Threads

  1. [CLOSED] How to show mask on ajax update panel update
    By egvt in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 18, 2012, 9:36 PM
  2. Replies: 0
    Last Post: May 09, 2012, 8:27 AM
  3. Update TreeGrid/Panel during AjaxEvents
    By fire3san in forum 1.x Help
    Replies: 1
    Last Post: Jul 13, 2010, 9:50 AM
  4. [CLOSED] TreeGrid: Header width when treegrid is flexible
    By wazige in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: May 06, 2010, 10:44 AM
  5. [CLOSED] [1.0] Update Lazy loaded TreeGrid row
    By pasion in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 27, 2010, 1:29 PM

Posting Permissions