Link to home
Start Free TrialLog in
Avatar of traport
traport

asked on

How do you combine fields in a JQGRID?

Instead of this:
{name:'lastname', label: 'Last Name', index:'lastname', width:200},
{name:'firstname', label: 'First Name', index:'firstname', width:250},

Open in new window


I essentially want: Last Name, First Name
Avatar of Big Monty
Big Monty
Flag of United States of America image

have a look at the Custom Formatter option

example:

function myFormatter(cellvalue, options, rowObject){
    return rowObject.firstName + " " + rowObject.lastName;
}

Open in new window

Avatar of traport
traport

ASKER

Thank you. I just can't seem to figure out how to incorporate that into my grid as a column.

Is it a new column? i.e.

{name: 'fullname', formatter:myFormatter, index... then what?}
ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of traport

ASKER

That has a column with 'undefined' as the values. I'm stumped.
Avatar of traport

ASKER

This was correct, I just had to lower case the 'n'. I had to place the function about my document.ready as well. Thanks so much.