Hello,
I am trying to replicate a "Copy selected row" on a webdatagrid.
I have a WebDataGrid with Selection behavior enabled and RowSelectType set to "Single". When the user selects any of the rows, I want to offer the possibilty of duplicating the contents of the selected row by "copy-paste" like functionality (i.e. "Ctrl C" to copy contents and then "Ctrl + V" to paste the contents elsewhere).
I want to highlight the selected row in some different way than a normal row selection, so the user is aware that the contents of that row are the ones being copied, and that it is not a normal selection of a row.
I need to do this from client side.
Googling around, I've reached the conlusion that I have to change the SelectedRowSelectorCssClass of the Selection behavior dynamically through Javascript, and I got to the point below, but it does not work.
Do you know how can I change the SelectedRowSelectorCssClass dynamically from client/Javascript?
.DefaultSelectCSSClass { background-color: Blue; background-image:none; color:Black; } </style>
function CopyWebImageButton_Click(oButton, oEvent) {
var webGrid = $find("MyWebDataGrid");
webGrid.get_behaviors().get_selection()._selectedRowSelectorCss = "CopyHighlightCSSClass";
// Rest of copy logic
...
}
function PasteWebImageButton_Click(oButton, oEvent) {
webGrid.get_behaviors().get_selection()._selectedRowSelectorCss = "DefaultSelectCSSClass";
Hello Rickycl,
They should change the styles of the grid. On server side you can handle on initialize event and there to apply the styles. When you apply the styles inspect the elements and check if the scc classes are applied to them. Sometimes they are successfully applied and the reason they do not affect is that they can be with lower importance than the default(inherited) ones.
Sincerely,
Georgi Sashev
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
Hello gsashev,
As I also need to change row selection style landed on this post, the sample you mentioned does not changes the row selection style, does it?
Different to the orginal post, I would need both options, to change the selection style clientside as well as server side.
Thank you very much.
Hello Greale,
Did you have a chance to review the sample in our samples browser?
For any further questions do not hesitate to contact me, I would be glad to help.
Thank you for posting in our community. This is possible with the latest version of our controls 2011 Vol2.
Please follow this sample code for more details:
http://samples.infragistics.com/aspnet/Samples/WebDataGrid/Editing-and-Selection/Clipboard/Default.aspx?cn=data-grid&sid=2ab1fa81-31ff-47c8-bfb9-ed3349e3e441
For any further questions do not hesitate to contact me.