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 10 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 10 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

6 + 13 =

Login with your Social Id:

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 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

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

Let us improve this post!

Tell us how we can improve this post?