0

I have this code below which will generate list of patients. Gridview summary is accurate but my pagination won't work. If I add id option 'id' => 'patientsList',, it will display all the patient on each page. How should I fix this? What are the possible solutions of this problem?

For my provider:

$provider = new ArrayDataProvider([
        'allModels' => $patientData,
        'pagination' => [
            'pageSize' => 10,
        ],
        'sort' => [
            'attributes' => ['_id', 'pin', 'name', 'gender', 'dateOfBirth', 'room','status','unknown']

        ],
    ]);

Then for setting up gridview:

GridView::widget([
         'dataProvider' => $provider,
         'id' => 'patientsList',
         'summary' => "Showing <b>{begin} - {end}</b>  of <b>{totalCount}</b> patients.",
         'rowOptions'   => function ($model, $key, $index, $grid) {
            if(isset($model['unknown']) &&$model['unknown']==1){
                        return [
                            'style' => 'cursor:pointer; color:red;',
                            'data-id' => $model['_id']
                            ];
            }
            else{
                        return [
                            'style' => 'cursor:pointer',
                            'data-id' => $model['_id']
                        ];
            }

            },
        'columns' => [
            'name', 
            'gender', 
            'room'
         ],

    ])
anon97
  • 15
  • 5

0 Answers0