Hello,
I have a grid with the sorting behavior enabled to sort both bound and unbound columns. When sorting the unbound column I find that different number of rows are being returned. I imagine I have an error with how I enable sorting with the unbound column. Can you help me with the set-up?
Note: In the initializeRow event, I have my hyperlink: e.Row.Items(0).Value = "Unique ID"
Thanks!
Hi,
The sample needed to be expanded a little bit to address this issue you are referring too. I have revised the sample and you should find that it is now okay.
Let me know if you need any additional assistance.
**Please note that I omitted the style sheets due to file size constraints. For proper styling of the grid you will need to bring the ig_res folder back into the project. You can do this by opening the project in the designer and select 'OK' when prompted to accept the sytle sheets.
This does work but only after the first click. On the first click it does nothing. Why is that?????
Troy,
That's a cool approach, unfortunately it removes sorting indicator from the column header being sorted. Is there any way to make it retain it?
how can we enable sorting for child grid columns with hyperlinks?
To accomplish this objective I handle the grid initialize row event to inject the hyper link into the unbound column:
protected void WebDataGrid1_InitializeRow1(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)
{
Random rdm = new Random();
// inject link html in the unbound column and get the link text from the hidden bound column
e.Row.Items.FindItemByKey("Link").Value = " <a href=\"somePage.aspx\" >" + e.Row.Items.FindItemByKey("LinkText").Value + " </a>";
}
Next, I implement a custom sorting on the client to sort the unbound column:
<script type="text/javascript" id="igClientScript">
var lastSortDirection = 1;
function WebDataGrid1_Sorting_ColumnSorting(sender, eventArgs) {
//if the link column is being sorted, set the actual sorting to the hidden LinkText column
if (eventArgs.get_column().get_key() == "Link") {
eventArgs.set_column(sender.get_columns().get_columnFromKey("LinkText"));
//the sort direction needs to be modified based on the last sort on the link column.
if (lastSortDirection == 1) {
eventArgs.set_sortDirection(2);
lastSortDirection = eventArgs.get_sortDirection();
} else {
eventArgs.set_sortDirection(1);
} </script>
Please let me know if you need any additional assistance regarding this matter.