optikalefx / OpenJS-Grid

OpenJS Grid is the easiest jQuery Grid ever. With very little work you can have a data grid that can do everything from sorting and searching to complex database queries. Best of all, its open source. So you can learn how it's all done.
http://square-bracket.com/openjs
MIT License
96 stars 46 forks source link

Drop downs, more than one #77

Closed jdamianb closed 9 years ago

jdamianb commented 9 years ago

Hello,

I have a doubt. How can I use 2 or more drop downs that reads info from a mysql database.

Thank you,

optikalefx commented 9 years ago

From the drop down example on this page http://square-bracket.com/openjs you can just specify as many $selects["{{FIELD}}"] as needed

jdamianb commented 9 years ago

But if I want data from another table on the same db what should I do?

optikalefx commented 9 years ago

as seen on that example page, just call $grid->table = "categories"; before you make your $grid->makeSelect That will tell makeSelect to use a different table

jdamianb commented 9 years ago

But what about two different tables for two different drop downs?

optikalefx commented 9 years ago
$grid->table = "categories";
$selects["CategoryID"] = $grid->makeSelect("CategoryID","Name");

$grid->table = "another_table";
$selects["active"] = array("1"=>"true","0"=>"false");

$grid->table = "another_another_table";
$selects["aNewColumn"] = $grid->makeSelect("CategoryID","Name");
jdamianb commented 9 years ago

Hi! I did that but now I know why it wasn't working. The problem I have is that I'm using spanish words with special characters lik "á", so that's why it wasn't loading the drop downs. I have posted my problem on another issue. I hope you can help me there.

Thank you!