Syncfusion 网格列表控件

发布于 2024-07-26 03:40:03 字数 158 浏览 5 评论 0原文

您好,

使用 Syncfusions Gridlist 控件:

用户应该能够选择各种行(1 行或多行),然后我需要一种方法来以编程方式确定选择哪些行。 我将在网格上使用上下文菜单,因此我需要找到此时选择了哪些菜单。

对上述问题的任何帮助都会很棒

HI,

using Syncfusions Gridlist control:

The user should be able to select various rows (1 or many), then I need a way to programmatically determine which rows are selected.
I will be using a context menu on the grid, so I need to find which ones are selected at that point.

Any help with the above would be great

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

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

发布评论

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

评论(2

十级心震 2024-08-02 03:40:03

您可以像这样访问选定的项目:

 foreach (SelectedRecord selectedRecord in Grid.Table.SelectedRecords)
                {
                    TypeBoundToDataGrid typeBound= selectedRecord.Record.GetData() as TypeBoundToDataGrid ;

                }

请注意:您需要通过执行以下操作来打开网格中的选择模式:

对于多重选择:

Grid.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
        Grid.TableOptions.AllowSelection = GridSelectionFlags.None;
        Grid.TableOptions.ListBoxSelectionColorOptions = GridListBoxSelectionColorOptions.ApplySelectionColor;
        Grid.TableOptions.ListBoxSelectionCurrentCellOptions = 
            GridListBoxSelectionCurrentCellOptions.WhiteCurrentCell 
            | GridListBoxSelectionCurrentCellOptions.MoveCurrentCellWithMouse;

对于单选

Grid.TableOptions.ListBoxSelectionMode = SelectionMode.One;
        Grid.TableOptions.AllowSelection = GridSelectionFlags.None;
        Grid.TableOptions.ListBoxSelectionColorOptions = GridListBoxSelectionColorOptions.ApplySelectionColor;
        Grid.TableOptions.ListBoxSelectionCurrentCellOptions = 
            GridListBoxSelectionCurrentCellOptions.WhiteCurrentCell 
            | GridListBoxSelectionCurrentCellOptions.MoveCurrentCellWithMouse;

Josh

You can access the selected items like this:

 foreach (SelectedRecord selectedRecord in Grid.Table.SelectedRecords)
                {
                    TypeBoundToDataGrid typeBound= selectedRecord.Record.GetData() as TypeBoundToDataGrid ;

                }

Please Note: You will need to turn on the selection mode in the grid by doing this:

For MultiSelection:

Grid.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
        Grid.TableOptions.AllowSelection = GridSelectionFlags.None;
        Grid.TableOptions.ListBoxSelectionColorOptions = GridListBoxSelectionColorOptions.ApplySelectionColor;
        Grid.TableOptions.ListBoxSelectionCurrentCellOptions = 
            GridListBoxSelectionCurrentCellOptions.WhiteCurrentCell 
            | GridListBoxSelectionCurrentCellOptions.MoveCurrentCellWithMouse;

For SingleSelection

Grid.TableOptions.ListBoxSelectionMode = SelectionMode.One;
        Grid.TableOptions.AllowSelection = GridSelectionFlags.None;
        Grid.TableOptions.ListBoxSelectionColorOptions = GridListBoxSelectionColorOptions.ApplySelectionColor;
        Grid.TableOptions.ListBoxSelectionCurrentCellOptions = 
            GridListBoxSelectionCurrentCellOptions.WhiteCurrentCell 
            | GridListBoxSelectionCurrentCellOptions.MoveCurrentCellWithMouse;

Josh

你又不是我 2024-08-02 03:40:03

检查右键单击网格时触发的网格事件,并查看为您提供的参数(通过使用“e”)。

Check for a grid event that is triggered when you right click on the grid, and see what arguments are given to you (by using 'e').

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