kartik-v / yii2-grid

Enhanced GridView with various utilities for Yii Framework 2.0
http://demos.krajee.com/grid
Other
556 stars 303 forks source link

First EditableColumn Not send Request Correctly #943

Closed juan0alfonso0agentcars closed 4 years ago

juan0alfonso0agentcars commented 4 years ago

Prerequisites

Code Example:::

gridview.txt

Steps to reproduce the issue

  1. Load 'kartik\grid\EditableColumn' as the first column of gridView
  2. Load Columns on kartik\grid\GridView
  3. Show when try to edit the first column, ajax not send correctly params like others columns

Expected behavior and actual behavior

Expected Behavior: Request ajax send next params: hasEditable: 1 editableIndex: 0 editableKey: 227 editableAttribute: km_or_ml <DataOfYiiMode

Actual Behavior (Id of some Yii model): id: 6989

When I follow those steps, I see... First Column with 'class' => 'kartik\grid\EditableColumn' not send request correctly.

I was expecting... The first column send correctly request, like others one

Environment

Browsers

Operating System

Libraries

Isolating the problem

kartik-v commented 4 years ago

You need to use indexBy('primary_key_colname') when you are generating your dataProvider so that the right record key is passed to EditableColumn for updating - refer this comment.

juan0alfonso0agentcars commented 4 years ago

Not Working, first editableColumn from first row its the only that not send all parameters on ajax request, only send id (the id its accord of the record).