Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

CArrayDataProvider unknown index error (sorting with cutted array) #1531

Closed
Yiivgeny opened this Issue · 2 comments

2 participants

Evgeny Blinov Carsten Brandt
Evgeny Blinov

Sample code

$testArray = array(
    array('id' => 1, 'field1' => 'value1', 'field2' => 'value2'),
    array('id' => 2, 'field1' => 'value3'),
);

$dataProvider = new CArrayDataProvider($testArray,array(
    'sort' => array(
        'attributes' => array('id', 'field1', 'field2')
    )
));

$this->widget('zii.widgets.grid.CGridView', array(
    'dataProvider' => $dataProvider,
    'columns' => array('field1', 'field2')
));

Initial rendered correctly, but sort this grid by field2 thrown exception Undefined index: field2 on framework/web/CArrayDataProvider.php(160)

Evgeny Blinov

Duplicate #1534

Evgeny Blinov Yiivgeny closed this
Carsten Brandt
Collaborator

creating a pull request for an issue is not duplicating, as pull request might get rejected and issue is still valid.

Carsten Brandt cebe reopened this
Carsten Brandt cebe was assigned
Carsten Brandt cebe closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.