I am using jqGrid
. One of the columns has the possible values:
Poor, Fair, Good, Very Good, Excellent, Ideal
But when you sort by this column they are ordered alphabetically like:
Excellent, Fair, Good, Ideal, Poor, Very Good
Instead of the intuitive order you would expect.
Is there a way to correct this?
update
Here is a snippet of the php code for generating the grid:
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
$conn->query("SET NAMES utf8");
$grid = new jqGridRender($conn);
//Class to generate query
require('DiamondSQL.php');
$dsql = new DiamondSQL();
$dsql->diamond_table = "rapnet_diamonds";
$dsql->shape_column = "shape";
$dsql->carat_column = "carat";
$dsql->clarity_column = "clarity";
$dsql->setShapes($_GET['shapes']);
$dsql->setCaratMin($_GET['caratMin'] ? $_GET['caratMin'] : "0");
$dsql->setCaratMax($_GET['caratMax'] ? $_GET['caratMax'] : "5");
$dsql->setClarityMin($_GET['clarityMin'] ? $_GET['clarityMin'] : "FL");
$dsql->setClarityMax($_GET['clarityMax'] ? $_GET['clarityMax'] : "I3");
$qry = $dsql->buildQuery();
$grid->SelectCommand = $qry;
$grid->dataType = 'json';
$grid->setColModel();
$grid->setUrl('myfirstgrid.php');
$grid->setGridOptions(array(
"caption"=>"Diamonds Found",
"rowNum"=>200,
"sortname"=>"diamond_id",
"hoverrows"=>true,
"sortable"=>0,
"scroll"=>1,
"height"=>300,
"altRows"=>true,
"colNames"=> array('ID', 'Shape', 'Carat', 'Clarity', 'Color', 'Cut')
));
$grid->renderGrid('#grid','#pager',true, null, null, true,true);
$conn = null;