laravel-jqgrid
laravel-jqgrid copied to clipboard
may be include new method fo prepare select-list ?
some like this:
public function prepareSelect_jqGrid( $data, $first = null){
if(!is_null($first)){
$data->prepend($first, '');
}
$base = array();
foreach($data as $k => $v){
$base[] = $k . ':' . $v;
}
return '\'' . implode(';', $base) . '\'';
}
now we can prepare SELECT from lists :
$listUsers = $this->prepareSelect_jqGrid(User::where('enabled', true)->get()->pluck('full_name', 'id'), ' - ALL - ');
..........................
->addColumn([
'label'=>'User full name',
'index'=>'user_id',
'align'=>'left',
'width' => 300,
'fixed' => false,
'editable' => true,
'editrules' => ['required' => true],
'edittype' => 'select',
'formatter' => 'select',
'editoptions' => [
-----------------------------------------------> 'value' => $listUsers,
'style' => 'width: 90%;',
]
]
)
Why don't you work on your idea, and send a pull request?
i am noob in laravel fasades :(
may you add facade + empty implementation for some static helper-functions ?
name for example : RenderUtils
first need method (generate json-list for select-type column) :
static public function prepareSelectList($data, $first = null){
if(!is_null($first)){
$data->prepend($first, '');
}
$base = array();
foreach($data as $k => $v){
$base[] = $k . ':' . $v;
}
return implode(';', $base);
}
on stage there thinking about adding new functionality facilitates work with daterange filter for columns with dates