We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Selecting all values in a Column

Hi, I looked at the HierarchyView Grouping Grid example and tried to set the AllowSelection property to allow me to click on a column header and select all the values in that column. Is that behavior allowed in the Grouping Grid? I was able to click on a column header and select all the cells in that column in the regular DataGrid. I tried setting the AllowDragColumns and AllowSortColumns to false but that did not help. Thanks, Erlly

8 Replies

AD Administrator Syncfusion Team March 28, 2005 11:25 PM UTC

Erlly, take a look at the example in the thread http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=26399 It lets you click on a column header and then draw the cells in that column selected by handling PrepareViewStyleInfo. Does that work for you? Stefan >Hi, >I looked at the HierarchyView Grouping Grid example and tried to set the AllowSelection property to allow me to click on a column header and select all the values in that column. Is that behavior allowed in the Grouping Grid? I was able to click on a column header and select all the cells in that column in the regular DataGrid. I tried setting the AllowDragColumns and AllowSortColumns to false but that did not help. > >Thanks, >Erlly


EB Erlly Bayuelo March 29, 2005 03:10 PM UTC

Hi, Yes, it somewhat works. Actually Anthony is on vacation so I took over the task. I just wanted to be able to handle selecting multiple columns (ctrl-clicking each one) I guess I will have to code it to handle multiple columns by making the variable that holds the selected columns some sort of collection to be referenced by PrepareViewStyle later. I would have to select the columns myself in TableControlCellClick by storing them in TableControl.Selections as follows. e.TableControl.Selections.Add(GridRangeInfo.Col(...)) And then in PrepareViewStyle I will draw the columns highlighted. Is that correct? >Erlly, > >take a look at the example in the thread http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=26399 > >It lets you click on a column header and then draw the cells in that column selected by handling PrepareViewStyleInfo. > >Does that work for you? > >Stefan > >>Hi, >>I looked at the HierarchyView Grouping Grid example and tried to set the AllowSelection property to allow me to click on a column header and select all the values in that column. Is that behavior allowed in the Grouping Grid? I was able to click on a column header and select all the cells in that column in the regular DataGrid. I tried setting the AllowDragColumns and AllowSortColumns to false but that did not help. >> >>Thanks, >>Erlly


AD Administrator Syncfusion Team March 29, 2005 10:02 PM UTC

Hi Errly, yes you could do that. Or you could make that one string which holds the name of the selected column a Hashtable and you store the names of all CTRL-clicked columns in there. One question: What selection mode are you using for records? Are you using the record-based selection mechanism (AllowSelection = None, ListBoxSelectionMode = SelectionMode.Multi) or the cell-based selection mechanism (AllowSelection = Cells)? The nice thing about having a hashtable with column names instead of using TableModel.Selection is that it wouldn''t interfere with your record selection logic. Stefan >Hi, >Yes, it somewhat works. Actually Anthony is on vacation so I took over the task. I just wanted to be able to handle selecting multiple columns (ctrl-clicking each one) I guess I will have to code it to handle multiple columns by making the variable that holds the selected columns some sort of collection to be referenced by PrepareViewStyle later. I would have to select the columns myself in TableControlCellClick by storing them in TableControl.Selections as follows. >e.TableControl.Selections.Add(GridRangeInfo.Col(...)) And then in PrepareViewStyle I will draw the columns highlighted. Is that correct? > >>Erlly, >> >>take a look at the example in the thread http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=26399 >> >>It lets you click on a column header and then draw the cells in that column selected by handling PrepareViewStyleInfo. >> >>Does that work for you? >> >>Stefan >> >>>Hi, >>>I looked at the HierarchyView Grouping Grid example and tried to set the AllowSelection property to allow me to click on a column header and select all the values in that column. Is that behavior allowed in the Grouping Grid? I was able to click on a column header and select all the cells in that column in the regular DataGrid. I tried setting the AllowDragColumns and AllowSortColumns to false but that did not help. >>> >>>Thanks, >>>Erlly


EB Erlly Bayuelo March 30, 2005 03:35 PM UTC

The reason for using Table.Selection is that we want to copy the selection to the clipboard versus just keeping track of selected columns. Then the user will paste the selection to a text file or Excel. I think if we do Table.Selection and then do a copy operation(Model.CutPaste.Copy() from an Edit->Copy menu item or the windows'' standard "Ctrl-C") anything in Table.Selection will be copied to the clipboard. Is this correct? A related question is: when data is copied to the clipboard from the grid, is it copied from the underlying table or what is displayed in the grid cell. The reason for the question is that we modify some of the displayed data in QueryCellInfo and PrepareViewStyle (that is: e.Style.CellValue = ''xxx'' or e.Inner.Style.CellValue = ''xxx'' or e.Inner.Style.FormattedText = ''xxx'') and we were wondering whether the modified displayed values were the ones copied to the clipboard or the table values.


AD Administrator Syncfusion Team March 30, 2005 06:43 PM UTC

Erlly, The text that gets copied is the displayed text. It is dermined by a call to style.GetFormattedText(style.CellValue, GridCellBaseTextInfo.CopyText); So, if you would want to return a different text to be copied to the clipboard you could handle the GridGroupingControl.QueryCellFormattedText event and check for e.TextInfo == GridCellBaseTextInfo.CopyText; Stefan >The reason for using Table.Selection is that we want to copy the selection to the clipboard versus just keeping track of selected columns. Then the user will paste the selection to a text file or Excel. I think if we do Table.Selection and then do a copy operation(Model.CutPaste.Copy() from an Edit->Copy menu item or the windows'' standard "Ctrl-C") anything in Table.Selection will be copied to the clipboard. Is this correct? > >A related question is: when data is copied to the clipboard from the grid, is it copied from the underlying table or what is displayed in the grid cell. The reason for the question is that we modify some of the displayed data in QueryCellInfo and PrepareViewStyle (that is: e.Style.CellValue = ''xxx'' or e.Inner.Style.CellValue = ''xxx'' or e.Inner.Style.FormattedText = ''xxx'') and we were wondering whether the modified displayed values were the ones copied to the clipboard or the table values.


AA Anthony Avella April 20, 2005 01:55 PM UTC

Stefan, Erlly and I are working on this together. I have a few questions. One of our goals is to copy all of the rows of a specified column. If the grid is grouped, we''d like to highlight and copy all of the displayed values in each row of the selected column to be able to paste them to another app. (Notepad, excel, etc...). If the grid is not grouped, we''d like to highlight and copy all of the detail rows in a chosen column to be able to paste them to another app. (Notepad, excel, etc...) We''d like the user to be able to initiate these actions by single clicking on the column''s header cell. We would also like to give the user the ability to single click in the upper-most left corner cell of the grid and highlight the whole grid so the user can copy what''s visible on the grid and paste to notepad, excel, etc... We''d like the user to copy and paste what''s on the grid, not the underlying record value. At times, these 2 values conflict. Currently, when we copy and paste either an individual summary cell, a selected range of summary cells, an individual detail cell, or a selected range of detail cells the problem above occurs. If we''ve modified the display value (current conversion, or some type of formatting) in either the QueryCellStyleInfo or the PrepareViewStyleInfo event handlers for display in the grid, that value is not copied and pasted - the underlying record value is copied. If we follow your recommendation (style.GetFormattedText(style.CellValue, GridCellBaseTextInfo.CopyText); So, if you would want to return a different text to be copied to the clipboard you could handle the GridGroupingControl.QueryCellFormattedText event and check for e.TextInfo == GridCellBaseTextInfo.CopyText;), nothing at all is copied for pasting. Pls advise. Thanks. >Erlly, > >The text that gets copied is the displayed text. It is dermined by a call to > >style.GetFormattedText(style.CellValue, GridCellBaseTextInfo.CopyText); > >So, if you would want to return a different text to be copied to the clipboard you could handle the GridGroupingControl.QueryCellFormattedText event and check for e.TextInfo == GridCellBaseTextInfo.CopyText; > >Stefan > >>The reason for using Table.Selection is that we want to copy the selection to the clipboard versus just keeping track of selected columns. Then the user will paste the selection to a text file or Excel. I think if we do Table.Selection and then do a copy operation(Model.CutPaste.Copy() from an Edit->Copy menu item or the windows'' standard "Ctrl-C") anything in Table.Selection will be copied to the clipboard. Is this correct? >> >>A related question is: when data is copied to the clipboard from the grid, is it copied from the underlying table or what is displayed in the grid cell. The reason for the question is that we modify some of the displayed data in QueryCellInfo and PrepareViewStyle (that is: e.Style.CellValue = ''xxx'' or e.Inner.Style.CellValue = ''xxx'' or e.Inner.Style.FormattedText = ''xxx'') and we were wondering whether the modified displayed values were the ones copied to the clipboard or the table values.


AA Anthony Avella April 27, 2005 12:48 PM UTC

What is the status of this??? > Stefan, >Erlly and I are working on this together. I have a few questions. > >One of our goals is to copy all of the rows of a specified column. > >If the grid is grouped, we''d like to highlight and copy all of the displayed values in each row of the selected column to be able to paste them to another app. (Notepad, excel, etc...). > >If the grid is not grouped, we''d like to highlight and copy all of the detail rows in a chosen column to be able to paste them to another app. (Notepad, excel, etc...) > >We''d like the user to be able to initiate these actions by single clicking on the column''s header cell. > >We would also like to give the user the ability to single click in the upper-most left corner cell of the grid and highlight the whole grid so the user can copy what''s visible on the grid and paste to notepad, excel, etc... > >We''d like the user to copy and paste what''s on the grid, not the underlying record value. At times, these 2 values conflict. > >Currently, when we copy and paste either an individual summary cell, a selected range of summary cells, an individual detail cell, or a selected range of detail cells the problem above occurs. > >If we''ve modified the display value (current conversion, or some type of formatting) in either the QueryCellStyleInfo or the PrepareViewStyleInfo event handlers for display in the grid, that value is not copied and pasted - the underlying record value is copied. > >If we follow your recommendation (style.GetFormattedText(style.CellValue, GridCellBaseTextInfo.CopyText); > >So, if you would want to return a different text to be copied to the clipboard you could handle the GridGroupingControl.QueryCellFormattedText event and check for e.TextInfo == GridCellBaseTextInfo.CopyText;), nothing at all is copied for pasting. > >Pls advise. > >Thanks. > > > > > > > > >>Erlly, >> >>The text that gets copied is the displayed text. It is dermined by a call to >> >>style.GetFormattedText(style.CellValue, GridCellBaseTextInfo.CopyText); >> >>So, if you would want to return a different text to be copied to the clipboard you could handle the GridGroupingControl.QueryCellFormattedText event and check for e.TextInfo == GridCellBaseTextInfo.CopyText; >> >>Stefan >> >>>The reason for using Table.Selection is that we want to copy the selection to the clipboard versus just keeping track of selected columns. Then the user will paste the selection to a text file or Excel. I think if we do Table.Selection and then do a copy operation(Model.CutPaste.Copy() from an Edit->Copy menu item or the windows'' standard "Ctrl-C") anything in Table.Selection will be copied to the clipboard. Is this correct? >>> >>>A related question is: when data is copied to the clipboard from the grid, is it copied from the underlying table or what is displayed in the grid cell. The reason for the question is that we modify some of the displayed data in QueryCellInfo and PrepareViewStyle (that is: e.Style.CellValue = ''xxx'' or e.Inner.Style.CellValue = ''xxx'' or e.Inner.Style.FormattedText = ''xxx'') and we were wondering whether the modified displayed values were the ones copied to the clipboard or the table values.


AD Administrator Syncfusion Team April 28, 2005 08:59 PM UTC

Anthony, Attached find a sample CustomSectionInGroupWithCustomSortAndDoubleClick.zip Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon