I have event InializeRow, HOw I can set cell attributes?
protected void PackageType_Grid_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e) { if (e.Row.Index == ((DataTable)PackageType_Grid.DataSource).Rows.Count - 1) { //I try this e.Row.Items.FindItemByKey("PackageName").Row.Attributes.Add("colspan", "7"); //I try this e.Row.Items.FindItemByKey("PackageName").Record.Attributes.Add("colspan", "7");
e.Row.Items.FindItemByKey("PackageName").Text = GetResourceText("MyPak_Miscellaneous_PackageName_Label"); } }
hello,
i have the same problem here with 15.1 Webdatagrid.
this client side way doesn´t work for me correctly.
the cell is merged, but the cells afterwards are still there. sould i remove them manually ? if yes => tell me how please
this is an example to show my problem
currentRow.get_cell(1).get_element().colSpan = 3;
input = >
<tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td></Tr>
output=>
<tr><td>1</td><td colspan=3>2</td> <td>3</td> <td>4</td> <td>4</td> </Tr>
Thanks!
Hello Anton ,
Thank you for posting in our forum.
You can’t apply any changes on the server side directly to the actual DOM elements the grid is going to render. Instead you would need to apply those changes on the client side on the grid’s initialize event.
If this attribute need to be applied based on some condition that can only be checked on the server side you could use the row’s Tag property to mark specific rows that you want to apply the change to .
You can set it in the InitializeRow event for example: e.Row.Tag = "colspan";
And on the client side you can check the tag of a row for example like this: sender.get_rows().get_row(i).get_tag();
So for example you could iterate through the rows , get their tags and set the attribute you want. For example:
function WebDataGrid1_Grid_Initialize(sender, eventArgs) {
for (var i = 0; i < sender.get_rows().get_length(); i++) {
var currentRow = sender.get_rows().get_row(i);
if (currentRow.get_tag() == "colspan") {
currentRow.get_cell(0).get_element().colSpan = 2;
}
Let me know if you have any questions or concerns.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://es.infragistics.com/support