laravel-jqgrid icon indicating copy to clipboard operation
laravel-jqgrid copied to clipboard

may be include new method fo prepare select-list ?

Open KrasilnikovKB opened this issue 8 years ago • 2 comments

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%;',
                                                             ]
                                           ]
                                  )

KrasilnikovKB avatar May 24 '16 14:05 KrasilnikovKB

Why don't you work on your idea, and send a pull request?

mgallegos avatar Jun 29 '16 15:06 mgallegos

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

KrasilnikovKB avatar Jul 12 '16 12:07 KrasilnikovKB