Changes
Title
unchanged
An important tip when you are using CArrayDataProvider.
Category
unchanged
Tips
Yii version
unchanged
Tags
unchanged
CArrayDataProvider
Content
changed
Yii
‘'s CArrayDataProvider is very helpful to display model relation data's directly on it.But it is truely a confusing one because by default it will assume a table field named “id” as primary key for its pagination purpose and what if you dont have field named “id” as primary key on your table? so its truely confusing and if you tried to display without an “id” field on ur table you will get an error like “yourmodel.id is not defined”.
To solve this CArrayDataProvider confusing problem you just need to use on of its attribute named “keyField” to specify your primary key field on your table.There is an property named “id” thats just an id of the dataProvider itself.[...]
Regards,
sirinsirin k
[Hire Yii developer](https://in.linkedin.com/in/sirink "Hire Yii developer")