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

Closed
Yiivgeny opened this Issue Oct 4, 2012 · 2 comments

Comments

Projects
None yet
2 participants
Contributor

Yiivgeny commented Oct 4, 2012

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)

Contributor

Yiivgeny commented Oct 4, 2012

Duplicate #1534

@Yiivgeny Yiivgeny closed this Oct 4, 2012

Owner

cebe commented Oct 5, 2012

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

@cebe cebe reopened this Oct 5, 2012

@ghost ghost assigned cebe Oct 5, 2012

@cebe cebe closed this Oct 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment