Ah, thank you, [member=‘zaccaria’], it’s a good notion about auto generated ids. Though, as far as I understand it, the problem will arise only if you use some kind of autogenerated scripted links/buttons/whatever in CGridView (ajaxLinks, for example).
CGridView itself doesn’t use such elements by default, and, fortunately, you can specify the ID for the grid via it’s options. So there won’t be any ytN ids in CGridView at all.
As for ajaxLinks and the likes of them, I avoid using such code in a piece of HTML which is updated via AJAX. The inner workings of AJAX-using scripts can be somewhat subtle sometimes, and I find it safer and simpler when I control such code completely.
I also agree with your point that default GII templates are in fact a sample, and a good one. And because of that they contain some things which are not needed in a normal backend. For example, in my CRUD templates the default admin view is used as index, and the old index is removed entirely. However, in this particular instance - I mean, grid AJAX update - the default template is misleading, especially for newbies who may not even think to check how it works, and can be very surprised to learn about requesting the entire page.
As to my proposal for fixing this grid issue, well, I’ve stated it above. Transform grid into partial view.
About the abovementioned menu item code duplication in default templates… considering your very valid point about default code being an example and a demo - probably nothing. For my own templates I’ve added a special function to controller which contains all menu item definitions and combines them for various actions according to the settings which look like this:
array(
'index' => array( 'create' ),
'create' => array( 'index' ),
'view' => array( 'index', 'create', 'update', 'delete' ),
'update' => array( 'index', 'create', 'view', 'delete' )
);
A bit slower, much safer, much easier to modify. The implementation is debatable, though, and should it be in a demo? Not sure…
P.S. Thank you for welcoming us.
Though actually I’ve been around for at least a year… just in read-only mode. 