Second grid not showing in multiple grid after update to 3.0.19

hello @johnny
after i update gc enterprice to the latest version my second grid on multiple grids mode are not showing up

this is my code

public function kinerja($extra)
    {
        $crud = $this->general->_getGroceryCrudEnterprise();

        $crud->setApiUrlPath(route('sdm.tr_kinerja_utama'));

        $outputAll = $crud->render();

        $js_files = $outputAll->js_files;

        $output = $outputAll->output;

        $crud2 = $this->general->_getGroceryCrudEnterprise();
        $crud2->setApiUrlPath(route('sdm.tr_kinerja_penunjang'));

        $output2 = $crud2->render();

        $output .= '<br/><br>' . $output2->output;
        $outputAll->output = $output;
        $extra['jsExtra'] = view('plugins.emodal')->render() . view('plugins.datepicker')->render();
        return $this->general->_showOutput($outputAll, null, @$extra);
    }

    public function tr_kinerja_utama($extra)
    {
        $rolesUser = $this->general->rolesUser();
        $crud = $this->general->_getGroceryCrudEnterprise();
        $crud->setTable('sdm_mst_kinerja');
        $crud->setSubject('Kinerja Utama', 'Kinerja Utama');
        $crud->displayAs('user_id', 'Pegawai');

        $crud->fieldType('created_at', 'invisible');
        $crud->columns(['rencana_kinerja', 'tahun', 'user_id']);
   $crud->setConfig('max_action_buttons', ['mobile' => 1,'desktop' => 3]);
        $crud->setActionButton('Target', 'fa fa-database', function ($row) {
            return "javascript:emodalIframe('Target Kinerja','" . route('sdm.target_kinerja', ['kinerja_id' => $row->id]) . "',false)";
        }, false);
        $crud->callbackAddField('tahun', function ($fieldType, $fieldName) {
            return '<input class="form-control yearpicker" name="' . $fieldName . '" type="text" value="">';
        });
        $crud->callbackEditField('tahun', function ($fieldValue, $primaryKeyValue, $rowData) {
            return '<input class="form-control yearpicker" name="tahun" value="' . $fieldValue . '"  />';
        });
        $crud->setMasterDetail(route('sdm.target_kinerja_view'));
        if (in_array(1, $rolesUser)) { //artinya dia superadmin
            $crud->setrelation('user_id', 'users', 'name');
            $crud->columns(['jenis', 'rencana_kinerja', 'tahun', 'user_id']);
        } else {
            $crud->columns(['jenis', 'rencana_kinerja', 'tahun']);
            $crud->where('sdm_mst_kinerja.user_id', Auth::user()->id);
            $crud->fieldType('user_id', 'hidden');
            $crud->fieldType('jenis', 'hidden');
            $crud->fieldType('kinerja_penunjang_id', 'hidden');
            $crud->callbackAddForm(function ($data) {
                $data['kinerja_penunjang_id'] = '0';
                $data['jenis'] = 'Utama';
                $data['user_id'] = Auth::user()->id;
                return $data;
            });
            $crud->where(['user_id' => Auth::user()->id]);
        }
        $crud->where(['jenis' => 'Utama']);
        $output = $crud->render();
        return $this->general->_showOutput($output, null, @$extra);
    }
    public function tr_kinerja_penunjang($extra)
    {
        $rolesUser = $this->general->rolesUser();
        $crud = $this->general->_getGroceryCrudEnterprise();
        $crud->setTable('sdm_mst_kinerja');
        $crud->setSubject('Kinerja penunjang', 'Kinerja penunjang');
        $crud->displayAs('user_id', 'Pegawai');

        $crud->fieldType('created_at', 'invisible');
   $crud->setConfig('max_action_buttons', ['mobile' => 1,'desktop' => 3]);
        $crud->setActionButton('Target', 'fa fa-database', function ($row) {
            return "javascript:emodalIframe('Target Kinerja','" . route('sdm.target_kinerja', ['kinerja_id' => $row->id]) . "',false)";
        }, false);
        $crud->callbackAddField('tahun', function ($fieldType, $fieldName) {
            return '<input class="form-control yearpicker" name="' . $fieldName . '" type="text" value="">';
        });
        $crud->callbackEditField('tahun', function ($fieldValue, $primaryKeyValue, $rowData) {
            return '<input class="form-control yearpicker" name="tahun" value="' . $fieldValue . '"  />';
        });
        $crud->setMasterDetail(route('sdm.target_kinerja_view'));
        if (in_array(1, $rolesUser)) { //artinya dia superadmin
            $crud->setrelation('user_id', 'users', 'name');
            $crud->columns(['jenis', 'kinerja_penunjang_id', 'tahun', 'user_id']);
        } else {
            $crud->columns(['jenis', 'kinerja_penunjang_id', 'tahun']);
            $crud->where('sdm_mst_kinerja.user_id', Auth::user()->id);
            $crud->fieldType('user_id', 'hidden');
            $crud->fieldType('jenis', 'hidden');
            $crud->fieldType('rencana_kinerja', 'hidden');
            $crud->setRelation('kinerja_penunjang_id', 'sdm_mst_kinerja_penunjang', '{nama} [{nilai}]', ['is_active' => 'Ya']);
            $crud->callbackAddForm(function ($data) {
                // $data['kinerja_penunjang_id'] = '0';
                $data['jenis'] = 'Penunjang';
                $data['user_id'] = Auth::user()->id;
                return $data;
            });
            $crud->displayAs('kinerja_penunjang_id', 'Rencana Kinerja');
            $crud->where(['user_id' => Auth::user()->id]);
        }
        $crud->where(['jenis' => 'Penunjang']);
        $output = $crud->render();
        return $this->general->_showOutput($output, null, @$extra);

    }

regards
Nasrul

hello @johnny

this is when i use previous version of gc with same code

and this is after i update to the latest version

only one grid is trigered not two

Regards
Nasrul

Hello @nasrul ,

This is indeed reproducible in my end as well. This is very weird! I will investigate and let you know for a fix or at least a work-around.

Regards
Johnny

Hello @nasrul ,

I’ve found the problem and this is a Grocery CRUD bug. There is no work-around for that, so I will try to create a new version with just this fix. I will keep you updated for any news. Thanks for the detailed reporting to help me understand and reproduce the issue :slight_smile:

Regards
Johnny

hello @johnny

thanks you for your repply
I will wait for the updated version.

Regards
Nasrul

Hello @nasrul ,

I have released the new version (3.0.20) with just the new fix. In case you are using composer, the update is pretty easy, you can just do:

composer update --prefer-dist

And if you are using Codeigniter 4 you also need to run:

php spark publish

If that doesn’t work then make sure that you have the file GroceryCrudPublisher.php at app/Publishers folder. You can see the file of publisher here: GroceryCrudPublisher.php · GitHub

and then run the command:

php spark publish

again.

In case you use a different framework or you don’t use composer you can check the wizard steps for upgrade from here: User's Page Login

Regards
Johnny

Hello @johnny
execelent now all is working properly
i am using laravel 10

thanks a alot @jonny

Regards
Nasrul

1 Like