I have a column with edittype = select
The SQL for the select uses an Order By stmt which brings back the data in the incorrect order. The SQL resolves correctly in phpmyadmin.
$col["edittype"] = "select";
$str = $detailGrid->get_dropdown_values("(SELECT ListID as k, name as v FROM iteminventory WHERE name = 'Special Instructions' LIMIT 1)
(SELECT i.ListID as k, CONCAT_WS(' ',name, IF( `QuantityOnHand`>=(`QuantityOnSalesOrder`+1),'','Not in Stock' ) ) as v
FROM pal_pd_products p
JOIN (SELECT name, ListID, QuantityOnHand, QuantityOnSalesOrder FROM iteminventory) i
ON i.name = CONCAT(p.model,'-',p.color_code)
WHERE p.status IN ('A','D','PR','RI','S')
ORDER BY p.model, p.color_code
$col["formatter"] = "select";
$col["editoptions"] = array("value" => $str);
(p.model and p.color_code are varchars)
Result in phpmyadmin:
604-35 Not in Stock ** Correct order
Result in Select dropdown:
604-35 Not in Stock ** This should show before 604-76
Everything else works just fine. (If I remove the UNION it makes no difference)
Thanks in advance
This case is little difficult to regenerate. It is working on basic example: http://prntscr.com/fxrj64
$str = $g->get_dropdown_values("select distinct client_id as k, name as v from clients ORDER BY name desc");
You can email me database sql dump to test-run this case. ([email protected])
How useful was this discussion?
Click on a star to rate it!
Average rating / 5. Vote count:
We are sorry that this post was not useful for you!
Let us improve this post!
Thanks for your feedback!