var t = {
list: {
"action_buttons[0]": "View",
"action_buttons[1]": "Share",
"action_buttons[2]": "Download",
"columns[0]": "Date of Study",
"columns[1]": "Patient",
"columns[2]": "File name",
"columns[3]": "Reporting <br>Physician",
"columns[4]": "Institution"
}
};
var list = {};
var re = /^(.*?)\[(\d+)\]$/;
var match;
for (var prop in t.list) {
match = prop.match(re);
if (typeof list[match[1]] == "undefined") {
list[match[1]] = [];
}
list[match[1]][match[2]] = t.list[prop];
}
t.list = list;
console.log(t);
{…}
list: {…}
action_buttons: […]
0: "View"
1: "Share"
2: "Download"
columns: […]
0: "Date of Study"
1: "Patient"
2: "File name"
3: "Reporting <br>Physician"
4: "Institution"
<label class="card2 effect__check">
<input type="checkbox">
</label>
SELECT `p`.`product_id`, `p`.`supplier_id`, `p`.`price`, `i`.`title`
FROM (
SELECT `product_id`, MIN(`price`) AS `price`
FROM `supplier_price`
GROUP BY `product_id`
) AS `mp`
JOIN `supplier_price` AS `p` ON `p`.`product_id` = `mp`.`product_id`
AND `p`.`price` = `mp`.`price`
JOIN `product` AS `i` ON `i`.`id` = `mp`.`product_id`
SELECT `p`.`product_id`, `p`.`supplier_id`, `p`.`price`, `i`.`title`
FROM (
SELECT `product_id`, `supplier_id`, `price`
FROM `supplier_price`
GROUP BY `product_id`, `supplier_id`, `price` WITH ROLLUP
HAVING `price` = MIN(`price`)
) AS `p`
JOIN `product` AS `i` ON `i`.`id` = `mp`.`product_id`