iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
please help me to solve the issue.
i have one grid , in which one column contains hyperlink. Here i want to change the background color of the row, once user click on the link cell.
i tried with both OnCellClick and OnRowSelect events.
OnCellClick: Here i first check whether the clicked column is hyperlinked column.
But the probelm is here i cannot able to change the background color of the full row.
is there any way to change the background color of the full row in OnCellClick event.
OnRowSelect: here i am not able to find out , whether the clicked column is the desired hyperlink column. is there any way to find out which column i clicked in this event.
Also let me know is it able to get and set the Background and Background2 in these two events
Hi Ca,
Yes, if we are using a grouped WebGrid, the group header will be counted as a Row. That is why, using that approach will give us an ugly result. In your case, I think we will need to use GetSelectedObject, instead of getting its row by GetRow. Here is the snippet:
function WebGrid1_OnCellClick(controlId, tblName, rowIndex, cellIndex, cellEl) { var indexNumber; var WebGrid1 = ISGetObject(controlId); var rootTable = WebGrid1.RootTable; var columnLength = rootTable.Columns.length; if (rootTable.GroupedColumns.length > 0) indexNumber = 2; else indexNumber = 1; setTimeout(function () { var getObject = WebGrid1.GetSelectedObject().ToRowObject(); if (getObject.Type != "GroupHeader") { for (var i = indexNumber; i <= columnLength; i++) { getObject.RowElement.cells[i].style.setAttribute("backgroundColor", "Red", true); } } }, 500); return true; }
I hope it can help solve your issue. Thank you and have a nice day.
Best Regards,
Andi Santoso
In your case, I would say that it would be better if we use OnCellClick client side event. With this event, it will make us easier to create a validation for the hyperlinked column.
At this moment, our WebGrid cannot change the background color for any particular row. However, what we can do is to change the color of cell by cell. Here is the snippet to do so:
<script language="javascript" type="text/javascript" id="WebGrid1_OnCellClick"> <!-- function WebGrid1_OnCellClick(controlId, tblName, rowIndex, cellIndex, cellEl) { var WebGrid1 = ISGetObject(controlId); var rowEl = WebGrid1.RootTable.GetRow(rowIndex).RowElement; for (var i = 1; i < rowEl.cells.length; i++) { rowEl.cells[i].style.setAttribute("backgroundColor", "Red", true); } return true; } --> </script>
I hope it helps. Thank you and have a nice day.
hi,
did you check it with grouped grid.
I am getting incorrect answer, because my grid is grouped by date field. the row count is not coming correctly .
i also tried the
var grid = ISGetObject("WebGrid1"); var selectedObject = grid.GetSelectedObject(); if (selectedObject != null) { var selectedRow = selectedObject.ToRowObject(); var pos= selectedRow.Position ; alert(pos); var rowEl = grid.RootTable.GetRow(pos).RowElement; for (var i = 1; i < rowEl.cells.length; i++) { alert(rowEl.cells[3].style.backgroundColor) } }
but here i am getting incorrect row position. so incorrect background
please help me.
thanks and regards
ca
thank you so much. it solved my problem
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname