Using a different field in the DB to sort on when the column header is clicked.

QuestionsUsing a different field in the DB to sort on when the column header is clicked.
Don Mangold asked 4 years ago

Is there a way to use a different field to sort a column than the one displayed in the column. We have a field padded with 0 to make a string with number embedded sort right but want to display the field that is not padded with 0's.

Example:

We display-

SEC:1
SEC:2

SEC:100

When we sort on this field we get.

SEC:1
SEC:10
SEC:100
SEC:2

We have another COLUMN in the DB
SEC:00001
SEC:00002

SEC:00100

When we sort it we get

SEC:00001
SEC:00002

Would like to display the non padded but use the sort on the second column when you click on the column header.

Thanks

1 Answers
Abu Ghufran answered 4 years ago

What you can do is, select a padded 0 string field with SQL query.
And in grid on_data_display event, remove padded zeros.

e.g.
http://hastebin.com/taqiguwuke.php

Your Answer

19 + 2 =

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!