Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
10240
How to enable sorting of an unbound column with a hyperlink
posted

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!

  • 500
    posted

    Hi Troy,

     

    Although it is two years since this post I would just like to let you know that I was able to use your script to resolve my sorting issue in the webdatagrid, version 14.2. Thank you for posting!

    • 1965
      posted

      This does work but only after the first click. On the first click it does nothing. Why is that?????

      • 10240
        posted in reply to B

        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.

        WDG_filterSort_unboundCol_wjQScript_MOD.zip
        • 10240
          posted in reply to [Infragistics] Troy Rodda

          Hi dev_here,

          I believe this issue is specific to the build of NetAdvantage 2011.1 that this sample was initially developed with. I tested with the most recent release of NetAdvantage 2013.1 (20131.2157) and do not any longer see this issue occuring.

          I recommend upgrading to NetAdvantage 2013.1 and install the service release. This should fix this for you.

          Thanks!

          • 10240
            posted in reply to [Infragistics] Troy Rodda

            Hi dev_here,

            I have created a private support case for you for addressing this issue. Please refer to support case CAS-123571-V2V5D7 for updates.

            Thanks

            • 10240
              posted in reply to B

              Hi dev_here,

              Just want to let you know that I am looking into this for you. I do see the behavior you are referring to when sorting. I will proceed to look further into this and will follow-up with what I find.

              Thanks!

              • 1965
                posted in reply to [Infragistics] Troy Rodda

                Yes I do need some help with this as its still not working for us. we are still on 11.1 and trying to upgrade. I have unbound columns with hyperlinks in them. Can you give me a simple exampel of how this works for such grids with just sorting and paging enabled..Everything works except that the first sort doesnt sort data, it it just introduces an icon and subsequent sorts does sort correctly(well, but the icon's reversed)

                Urgent!

            • 1965
              posted

              how can we enable sorting for child grid columns with hyperlinks?

              • 1290
                posted in reply to B

                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?

              • 10240
                posted

                Hello,

                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);

                                    lastSortDirection = eventArgs.get_sortDirection();

                                }

                            }

                        }    </script>

                Please let me know if you need any additional assistance regarding this matter.