nov*_*ick 2 codeigniter crud grocery-crud
有没有人知道如何延长set_relation()?
这是一个想法,基于Grocery Crud员工和办公室桌子的例子
$crud->set_relation('officeCode','offices','city');
Run Code Online (Sandbox Code Playgroud)
代码输出将显示下拉列表中的所有城市,但我想扩大set_relation()以按状态过滤所有城市以显示在下拉列表中?
例如,我想在下拉列表中显示所有亚利桑那州的城市,有没有人在使用杂货店之前完成此操作?
参考示例:
我知道我的回答是一些过时的,现在可能对OP没什么用处,但我猜有很多人可能正在看这篇文章,以寻找他们自己的set_relation问题的灵感.我提出了一个更简单的解决方案...(对Idham的公平性我不知道set_relation()的第4个参数何时可用.)
...
$state = "AZ"; // or however you get the state you want to filter by
$crud->set_relation('officeCode','offices','city', 'officeCode IN (SELECT officeCode FROM offices WHERE state='.$state.')');
...
Run Code Online (Sandbox Code Playgroud)
瞧!真正的杂货_CRUD真棒!
| 归档时间: |
|
| 查看次数: |
9934 次 |
| 最近记录: |