In my case, I have a $dataProvider which pasted forom controller. In view layout, i can get $dataProvider value by cgridview.
But, if I want to add a new reocord to the dataprovider before fetch it by gridview.
For example:
If I find all my model [in this case, i’ll call User model], in User model, there are 5 records, when I load layout, i want to add to $dataProvider a last record.
A bit off-topic, but… And about one-string solutions. You really gave a short-cut version (shall I give you another +1? ). But I’m always laughing, if some developer is trying to show-off his experience by saying that he can do this or that in one line. White chars (spaces and new line breaks) are for humans, compiler always ignores them, am I right. You could write whole long script in one enormously long line, by separating statements only with ; and brackets {} right?
Of course I am for readable code, but the best code is a short and readable one And a little note: PHP scripts are executed faster without tons of comments and white spaces, but it’s a different topic