有没有办法在树模式下使用 telerik RadGrid 跳过一个级别?

发布于 2024-12-09 10:32:29 字数 589 浏览 0 评论 0原文

情况如下:我有一个两级树,正在分层 RadGrid 中显示:

-Category 1
--Cat 1 Section 1
--Cat 1 Section 2
-Category 2
--Cat 2 Section 1
--Cat 2 Section 2
--Cat 2 Section 3
-Category 3
--Cat 3 Section 1

等等。但我刚刚收到一个新的要求,即类别本身实际上是另一种实体的子级:

-Bucket 1
--Bucket 1 Category tree...
-Bucket 2
--Bucket 2 Category tree...

我无法弄清楚如何在 RadGrid 中表达的要求部分是这样的(实际上这是从整个丑陋的简化而来的)真相):如果数据集中有多个桶,他们希望树的根级别是桶,但如果只有一个桶,他们不会 希望根是单个存储桶节点;相反,他们只是希望根级别成为该单独存储桶中的类别。

我的问题是,我没有找到一种方法来从控件中删除该存储桶级别并将下一个级别提升到根。有什么办法可以做到这一点吗?提前致谢。

Here's the situation: I've got a two level tree that I'm displaying in a hierarchical RadGrid:

-Category 1
--Cat 1 Section 1
--Cat 1 Section 2
-Category 2
--Cat 2 Section 1
--Cat 2 Section 2
--Cat 2 Section 3
-Category 3
--Cat 3 Section 1

and so on. But I was just handed a new requirement that the categories themselves are actually children of another kind of entity:

-Bucket 1
--Bucket 1 Category tree...
-Bucket 2
--Bucket 2 Category tree...

The part of the requirement that I can't figure out how to express in the RadGrid is this (actually this is simplified from the whole ugly truth): if there are multiple buckets in the data set, they want the root level of the tree to be the buckets, but if there is only one bucket, they do not want the root to be that single bucket node; rather they just want the root level to be the categories in that lone bucket.

My problem is that I'm not seeing a way to remove that bucket level from the control and promote the next level to the root. Is there any way to do this? Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满栀 2024-12-16 10:32:29

这一切都取决于您创建的绑定。我认为没有其他方法可以做到这一点。

if (ShowAll)
{
     RadGrid1.DataSource = GetBucketsAll();
} 
else
{
     RadGrid1.DataSource = GetCategoriesByBucketId(id);
} 

然后通过 GridDetailTableDataBindEvent 进行操作。

It will all come down to the binding that you create. I don't think there is another way to do it.

if (ShowAll)
{
     RadGrid1.DataSource = GetBucketsAll();
} 
else
{
     RadGrid1.DataSource = GetCategoriesByBucketId(id);
} 

Then work your way thru the GridDetailTableDataBindEvent.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文