Janath
(Janath Nalaka)
May 31, 2012, 1:38am
1
CGridView view with custom template
$this->widget(‘application.components.CGridView’, array(
‘id’=>‘notesgrid’,
‘selectableRows’=>1,
‘template=>’<div class=“grid-view-body”>{items}</div><div>{pager}</div>’,
…
When i try to access the selected row I get nothing. However, I debug this issue and found out that following jquery line of getSelection method in jquery.yiigridview.js file does not work with the above template.
this.children(’.’ + settings.tableClass).children(‘tbody’).children().each(function (i) {
Previous version had following jquery code which worked with custom template.
$(’#’+this.attr(‘id’)+’ .’+settings.tableClass+’ > tbody > tr’).each(function(i){
Anyone got a solution for this?
softark
(Softark)
May 31, 2012, 1:49am
2
Hi Don123,
I think you should report this issue in github.
[EDIT]
As for the moment what we can do may be, as you may agree …
Remove the wrapping <div> from your template … you may wrap the whole grid, not only the grid’s {item} … and modify your css selector accordingly.
Add extra lines to retrieve selected id on your own in your selectionChanged function … discarding the given ‘id’ parameter.
or
Customize jquery.yiigridview.js … you may not like it.
mdomba
(Maurizio Domba Cerin)
May 31, 2012, 7:46am
3
Janath
(Janath Nalaka)
May 31, 2012, 8:55am
4
softark:
Hi Don123,
I think you should report this issue in github.
[EDIT]
As for the moment what we can do may be, as you may agree …
Remove the wrapping <div> from your template … you may wrap the whole grid, not only the grid’s {item} … and modify your css selector accordingly.
Add extra lines to retrieve selected id on your own in your selectionChanged function … discarding the given ‘id’ parameter.
or
Customize jquery.yiigridview.js … you may not like it.
Thank you. I will try this.