$grid["sortorder"] by specific names within that field?

Questions$grid["sortorder"] by specific names within that field?
Devon asked 8 years ago

Hello,

I was wondering if you can sort by specific names within a column? Right now I have 4 specific names within the column, for argument sake lets say: (A, B, C, D)

I was wondering if i could sort this (A,C,B,D) with that column

$grid["sortname"] = "column_name"
$grid["sortorder"] = "A, C, B, D

Would i need to presort this within MYSQL statement?

Thanks!

2 Answers
Abu Ghufran answered 8 years ago

You can use mysql syntax of field(col, val1, val2, …) e.g.

$opt["sortname"] = "FIELD(column_name, 'A', 'B', 'C', 'D', 'E')"
$opt["sortorder"] = ""

$g->set_options($opt);

Your Answer

13 + 4 =

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?