Select Lines in Grid
Séverine LE ROCH
Hi!In an user table I want to launch a grid wich shows items and other infomations about items (with a query). Since this grid, I want that my customer selects many lines and when he presses a button all lines selected are send in the user table.
I have doing the grid to show the result of my query: it's ok
But I don't know how I can select many lines and how lines can go in the user table.
I put my code in attachment.
Thank you
Séverine
Attachment
[url=http://www.coresystems.ch/wp-content/../wp-content/forum-file-uploads/sleroch/Code_Envoi_Coresuite.txt]Code_Envoi_Coresuite.txt[/url]
Anders Olsson
Hi Séverine,To make multiple lines selectable, set the SelectionMode property of the grid to Auto:
grid.SelectionMode = SwissAddonFramework.UI.Components.Grid.SelectionModes.Auto;
You will now be able to select multiple lines while holding down the CTRL key.
I added an OK button (_boutonOK) to your code and attached a delegate to the click event to demonstrate how to get the selected data:
SwissAddonFramework.UI.EventHandling.ItemEvents.ClickEventHandler delOK = null;
delOK = delegate(SwissAddonFramework.UI.EventHandling.ItemEvents.Click ev)
{
for (int i = 0; i < grid.SelectedRows.Count; i++)
{
int rowIndex = grid.SelectedRows.RowIndex(i);
string itemCode = grid.DataTable.GetValue(0, rowIndex);
string itemName = grid.DataTable.GetValue(1, rowIndex);
string w3c = grid.DataTable.GetValue(2, rowIndex);
// Do something with the data...
}
};
_boutonOK.AddHandler_Click(SwissAddonFramework.UI.Components.ModeComponent.FormModes.ALL, null, delOK);
The "coresuite framework way" of working with a UDT is to create a class that derives from SwissAddonFramework.DI.UserTables.DAOUserTable. Please refer to the framework documentation for more information about that.
Kind regards,
Anders
Séverine LE ROCH
Hi anders,Thank you very much for your answer.
Where I can found the framework documentation please?
Kind Regards,
Séverine
Anders Olsson
Hi Séverine,in the coresuite framework forum, check the first post "Framework: Development Version". There you will find download links to samples. These zip files also contain the framework documentation.
Regards,
Anders
Séverine LE ROCH
It works!Thank you very much anders.
Séverine
0
Please sign in to leave a comment.
Comments
0 comments