asp.net gridview not showing sort ability

asp.net gridview not showing sort ability

dharricdharric Posts: 17Questions: 0Answers: 0
edited March 2011 in General
I've created a datatable from my asp.net gridview controls table. The table does have the required thead and tbody elements. However I get no sorting on my header items. I do get the number of entries drop down and the search textbox and I'm also even able to add the filtering by drop down functionality to my table's footer. However for some reason the sorting buttons are missing. Any ideas?

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    Most likely a path issue. If you look in your server's error log, I suspect you'll see requests for images at paths where they are not? In fact does the sorting work if you just click on the elements? If not, is it disabled or are you getting a Javascript error? A link would be very useful.

    Allan
  • dharricdharric Posts: 17Questions: 0Answers: 0
    Oh man how did you know that? Your right clicking on the names does do the sorting. But my images are missing. Was there a css file I was supposed to add or something?

    Also I'm trying to add the drop down based filtering to my header row or maybe the first row in my body. Right now because I only have one row in my header when I turn on datatable's filtering functionaility I get the filtering drop down's and they work great, but my header titles are overwritten by those same drop downs. Thanks again!
  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    Well there is the default CSS file and images which comes with the DataTables package - you can use that (demo_table.css) if you want. Otherwise you can assign your own to the sorting classes ( http://datatables.net/styling/ids_classes ).

    Second point - like this but in the header: http://datatables.net/examples/api/multi_filter_select.html ? Just move the select elements to a second TR element in the THEAD and use TD elements for the cells rather than TH (to stop DataTables using them for sorting).

    Allan
  • dharricdharric Posts: 17Questions: 0Answers: 0
    Great thanks. Now I tried to use the themeroller and that works pretty well. However I'm getting a strange issue where the sorting icons are not showing up on the side of the header cell. Instead they appear below the header text as if they're on their own row (I checked and they are not). How can I force them onto the side?
This discussion has been closed.