Andrew B
|
Posted: 01/23/2002, 8:38 PM |
|
Is there a way to change which fields can be sorted by in a grid form? I would like to remove sorting from some of my fields which do not have indexes on them to speed up the sorting.
I don't see a way to have some fields be non-sortable, though I thought this was possible.
|
|
|
kmc
|
Posted: 01/23/2002, 9:41 PM |
|
Definitely one for the wish list - in field properties a checkbox to allow/disallow a sort on this field in the grid.
|
|
|
Andrew B
|
Posted: 01/23/2002, 10:07 PM |
|
Thanks for makin me feel a little better. I could have sworn I had made some sortable and some not, and I was flogging myself because I could not find it again.
I will submit this as a wish list item sometime tonight.
|
|
|
Nicole
|
Posted: 01/24/2002, 1:55 AM |
|
Andrew,
currently the workaround requires manual coding in CC events. The most simple approach is to use custom sql for the grid form. Select 'Allow Sorting' checkbox on form/properties . In this case field captions will be shown as url links. Then you should add custom code to Open event for sorting. E.g.:
ASP:
iSort = GetParam("FormResults_Sorting")
if iSort = 1 then sOrder = " order by i.name" & sDirection
if iSort = 2 then sOrder = " order by i.author" & sDirection
if iSort = 3 then sOrder = " order by i.price" & sDirection
PHP:
$iSort = get_param("FormResults_Sorting");
if ($iSort == 1) $sOrder = " order by i.name" . $sDirection;
if ($iSort == 2) $sOrder = " order by i.author" . $sDirection;
if ($iSort == 3) $sOrder = " order by i.price" . $sDirection;
|
|
|
Andrew B
|
Posted: 01/26/2002, 8:55 PM |
|
That would def. work, and when the site is about ready I will go through and make those kind of changes.
But... I do not like writing custom code. Not because it is hard, or for other reasons. It is mostly because it is another small piece that needs to be maintained, and since finding custom code is difficult this is a bit of a pain. This type of thing should be in the options for the form. I have not problem writing cust. code for tasks that CC obviously not do (email, stored procedures, &c.)
My current method for SP's is to create a query that returns the proper column names (same as the sp's) through SQL tricks and then replace the query with my sp call. That way I get the same columns out, and I am also able to use the normal CC method to fill those cells, etc.
|
|
|
|