User Profile & Activity

A Yousif Member
Page
of 29

Glenn,

Would you please attach the sample you used for this?  Thank you.

Hello Glenn,

I guess there's no way to use the data key field and still be able to track the same children who may have separate parents?  I guess we'll have to use the solution we're using to make sure our IDs are unique.  Thanks.

I wanted to post an update.  We were able to find a workaround.  We basically had to force, in our result set data, two new columns that contain the unique ID at every level.  Below is a short example of what the new data set looks like.  We really should not have to do this since the grid should be "smart enough" to use the data key field for uniqueness.  I hope you can provide a fix for this soon to help us and others lower the cost of delivering more data.  Thank you.

New data set format

rowKey                                  uniqueParentID              uniqueContactID                      parentID   contactID contactLastFirstName
--------------------------------------- --------------------------- --------------------------------- ----------- ----------- --------------------
46740,0,0,0,0,0,0,0,0                   0                           0,46740                                     0       46740 Masked Name
46741,0,0,0,0,0,0,0,0                   0                           0,46741                                     0       46741 Masked Name
51863,0,0,0,0,0,0,0,0                   0                           0,51863                                     0       51863 Masked Name
53880,0,0,0,0,0,0,0,0                   0                           0,53880                                     0       53880 Masked Name
53880,438,0,0,0,0,0,0,0                 0,53880                     0,53880,438                             53880         438 Masked Name
46740,6515,0,0,0,0,0,0,0                0,46740                     0,46740,6515                            46740        6515 Masked Name
51863,51879,0,0,0,0,0,0,0               0,51863                     0,51863,51879                           51863       51879 Masked Name
51863,51924,0,0,0,0,0,0,0               0,51863                     0,51863,51924                           51863       51924 Masked Name
46740,52291,0,0,0,0,0,0,0               0,46740                     0,46740,52291                           46740       52291 Masked Name
53880,52778,0,0,0,0,0,0,0               0,53880                     0,53880,52778                           53880       52778 Masked Name
46741,55709,0,0,0,0,0,0,0               0,46741                     0,46741,55709                           46741       55709 Masked Name
46740,6515,6320,0,0,0,0,0,0             0,46740,6515                0,46740,6515,6320                        6515        6320 Masked Name
46740,6515,6508,0,0,0,0,0,0             0,46740,6515                0,46740,6515,6508                        6515        6508 Masked Name
46740,52291,6516,0,0,0,0,0,0            0,46740,52291               0,46740,52291,6516                      52291        6516 Masked Name
46740,52291,47202,0,0,0,0,0,0           0,46740,52291               0,46740,52291,47202                     52291       47202 Masked Name
46741,55709,47499,0,0,0,0,0,0           0,46741,55709               0,46741,55709,47499                     55709       47499 Masked Name
46741,55709,47508,0,0,0,0,0,0           0,46741,55709               0,46741,55709,47508                     55709       47508 Masked Name
46740,52291,49120,0,0,0,0,0,0           0,46740,52291               0,46740,52291,49120                     52291       49120 Masked Name
46741,55709,49234,0,0,0,0,0,0           0,46741,55709               0,46741,55709,49234                     55709       49234 Masked Name
53880,438,50102,0,0,0,0,0,0             0,53880,438                 0,53880,438,50102                         438       50102 Masked Name
46740,52291,50147,0,0,0,0,0,0           0,46740,52291               0,46740,52291,50147                     52291       50147 Masked Name
46740,52291,50169,0,0,0,0,0,0           0,46740,52291               0,46740,52291,50169                     52291       50169 Masked Name
51863,51879,51874,0,0,0,0,0,0           0,51863,51879               0,51863,51879,51874                     51879       51874 Masked Name
51863,51879,51890,0,0,0,0,0,0           0,51863,51879               0,51863,51879,51890                     51879       51890 Masked Name
51863,51924,51909,0,0,0,0,0,0           0,51863,51924               0,51863,51924,51909                     51924       51909 Masked Name

I've also attached the new format data set, as well as the original one, for convenience if you'd like to use it for testing.

Hello,

Thank you for your feedback. Unfortunately, it is not a bug. The current method can only open SelfRefRow in one level, not all SelfRefRow include the child. 

Regards,
Handy

Handy,

Would you kindly submit it as a feature request please?  It would really be helpful to not have to do this programmatically, i.e., when you select a specific node to expand, it should, when rendered, have its parents expanded too.  That behavior, at least to me, seems to be the obvious one and is what I had expected.  Thanks a lot.

Okay, I found a way to work around the issue above which still should have worked and I'd consider it a bug.  In our workaround, we were lucky in that the keys contained what we need to start expanding at the parent and work our way down.

foreach (string strKey in FoundItemKeyValueList)
{
    // get our find target and current row's key and move its individual ids
    // into their own arrays so we can compare and drill down to our found
    // target by expanding the parent rows
    string[] arFoundIds = strKey.Split(',');
    string[] arCurrentIds = e.Row.KeyValue.ToString().Split(',');

    // if we match our key fully, then we're at our target so we do not need
    // to expand anything but we do need to select it
    if (strKey == e.Row.KeyValue.ToString())
    {
        // and then select our item
        e.Row.Selected = true;
    }
    // if we haven't found our target yet, then expand the parent where our
    // target lives until we get to it.  We determine this by checking
    // our current row against our target at the current level which would
    // have the same key IDs
    else if (arFoundIds[e.Row.SelfRefLevel] == arCurrentIds[e.Row.SelfRefLevel])
    {
        e.Row.ExpandSelfRefRow();
    }
}

Handy,

This is working but not as expected.  Unfortunately, it's not expanding the entire levels above the item.  For example, if I have the following:

- Item 1
-    Item 1-1
+       Item 1-1-1
-       Item 1-1-2
           Item 1-1-2-1
+    Item 1-2
If I need to select and expand to item 1-1-2-1, the grid comes up like this
+ Item 1
           Item 1-1-2-1
+    Item 1-2

I tried the following code to expand everything going up in the InitializeRow override but it does not work:

if (strKey == e.Row.KeyValue.ToString())
{
    // select our item
    e.Row.Selected = true;

    // expand all the rows from the bottom up
    WebGridRow oWorkRow = e.Row.SelfRefParentRow;
    while (oWorkRow != null)
    {
        oWorkRow.ExpandSelfRefRow();
        oWorkRow = oWorkRow.SelfRefParentRow;
    }
}

How can I get the grid to expand all the parents too?

Great, thank you Handy.  I'll give this a try today and see how it goes.

Hi Yudi,

No we can't go back, but thankfully we have a workaround which works right now.  My only concern in the workaround implmentation is that it can break if the architecture changes in a future release and that's why it would be nice to have a fix so we don't have to rely on infused code for a workaround.  Thanks a lot.

Hi Yudi,

Thanks for checking.  We have a workaround for now but would really like this fixed soon.  Also, we do not hard-code control names into any of our client-side code because we can't since we don't know what control triggers this handler.  It's easy to do that when you have a simple page, but we work with a very complicated application with many controls.

I hope we can get a fix soon though.  Thanks again.

Okay, thanks Handy.  Yeah, I posted it as a request separately since it was off topic in this thread and figured others who want the feature can chime in. ;)

All times are GMT -5. The time now is 8:51 AM.
Previous Next