How to grouping the title in php grid?

QuestionsHow to grouping the title in php grid?
Denis Fontaine asked 2 weeks ago

Hello,

I would like to group the following columns into one column on the grid:

  • last name and first name,
  • 2 email columns
  • 2 telephone columns
  1. Columns in MySql: last name, first name, e-mail_1, e-mail_2, tel_1, tel_2
  2. Current columns in the grid: | Name | First name | Email | Email | Phone | Phone |
  3. Desired: | Name | Email | Phone |

Thank you for your help

View post on imgur.com

2 Answers
Mike answered 1 week ago

You can do this in your query with the CONCAT function. I find it’s easier to use a sub-query selection so the sorting/grouping still works. The ” ” in the middle adds a space character – you can add whatever you like.

Something like this should work for you:

SELECT

fullname, fullemail, fullphone

FROM

(SELECT

CONTACT(firstname, ” “, lastname) as fullname,

CONCAT(email 1, ” “, email 2) as fullemail,

CONCAT(phone 1, ” “, phone 2) as fullphone

FROM

TABLE) subquery

Abu Ghufran Staff answered 1 day ago

Hello,

Concat solution will work. Alternate solution would be to have a new column along with these column values. e.g.

Make first_name and last_name coulmns hidden.

$col = array();
$col["name"] = "first_name"
$col["hidden"] = true;
$cols[] = $col;

$col = array();
$col["name"] = "last_name"
$col["hidden"] = true;
$cols[] = $col;

Create a new virtual column that will show both column values.

$col = array();
$col["name"] = "full_name"
$col["title"] = "Full Name"
$col["template"] = "{first_name} {last_name}"
$cols[] = $col;

 

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

3 + 8 =

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?