Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4040
Recursive loop inside grid layouts hierarchy
posted

Hi,

I already wrote a post about this problem, but I don't have a solution.
Sorry to have to write a post again (see http://ko.infragistics.com/community/forums/p/86514/432978.aspx#432978) 

I am trying to use igHierarchicalGrid with several levels.
As I understand one sub-grid is generated for each level.

I would like to recursivelly loop inside the list and for each "node"/grid, I would like to know if it is a leave (last level). So :

     1 - if it is not a leave I should be able to expand or collapse the level

     2 - if it is a leave I should be able to change grid options (ex : editMode)

Examples I found allow to browse first level only.

Do you have an example of code to achieve this two points ?

Thanks for your help.

Alain. 

Parents
  • 2735
    Suggested Answer
    posted

    Dear Cosoluce_Stones,

    Thanks for using Ignite UI controls.

    What I can suggest for achieving your requirement is binding the grid on igchildgridcreated event and checking whether the grid has expandable rows. The following code snippet illustrates my suggestion:


    $("#hierarchicalGrid").on("igchildgridcreated", function (evt, ui) {
    if ($(ui.element).find("td[data-parent='true']").length > 0) {
      $(ui.element).igGrid("option", "caption", "not leave");
    } else {
       $(ui.element).igGrid("option", "caption", "leave");
    }
    });

    Please note that grid options could not be set at runtime. For example, the edit mode could be set/get at initialization only.

    Please feel free to contact me if you have any additional questions regarding this matter.

    Best Regards,
    Stanimir Todorov

Reply Children
No Data