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
90
getText from a cell in a multiple band
posted

Hi,

I'm able to getText of a cell in the band[0] but I'm not able to find a way to getText of a cell in the band[1] of my ultraWebGrid.

 

When I'm trying to get the cell of the band zero I type:

 

cell = UGrid_Dispatch.Rows[i].Cells[j];

String text = cell.GetText();

 

but I don't see how to do the same with the band[1]...

 

Can someone give my a snippet of code for doing that?

 

Thank for your help.

 

Fiodor.

Parents
No Data
Reply
  • 45049
    Suggested Answer
    posted

    You need to know where in your hierarchy exists the row you're after, including a reference to each of its parent rows - all the way up to the root row in band 0.  Each row has a collection of its own child rows.

    For instance, say you want to loop through all rows within bands 0 and 1 of a grid.  The following JavaScript would be your basic setup:

    // Assume that "grid" is a reference to your WebGrid instance
    var rowCount0 = grid.Rows.length;
    for (var i = 0; i < rowCount0; i++)
    {
        var row0 = grid.Rows.getRow(i);

        // Do something with the band 0 rows here

        var rowCount1 = row0.ChildRowsCount;
        for (var j = 0; j < rowcount1; j++)
        {
            var row1 = row0.getChildRow(j):

            // Do something with the band 1 rows here
        }
    }

    The getChildRow() method is one way of getting at the child rows of a particular parent row.  It iis likely one of the "cleaner" approaches, from the perspective that it's relatively consice and easy-to-read.

Children