Hello,
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.
code:
$col["edittype"] = "select";
$str = $detailGrid->get_dropdown_values("(SELECT ListID as k, name as v FROM iteminventory WHERE name = 'Special Instructions' LIMIT 1)
UNION
(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
LIMIT 2000)");
$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
604-76
604-95
6043-1
Result in Select dropdown:
604-76
604-95
6043-1
6047-3
…
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
Hello,
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])