GridView in renderPartial dublicates its id name after ajax post


I am using a renderPartial page, where i have a gridView. When i update this view through a ajax post from controller, this is the result I am having.

<div id="players-grid" class="grid-view">

<div id="players-grid" class="grid-view">

<div class="summary">Εμφάνιση 1-1 από 1 των αποτελεσμάτων.</div>

<table class ...

The problem is, that when I am trying to manipulate data, such as selected rows in the new gridView, is not working because the gridview.js is confused with the remained id="players-grid" from the first call of renderPartial, at creation time. I could remove this using javascript, but I think it will be better if there is was another solution, because the remained id should have been removed after the second call of renderPartial through ajax post.

I downloaded the new version of yii 1.1.11, and tried again from the start. I had other problem now, at the ajax button.

<?php echo CHtml::ajaxSubmitButton('Καταχώρηση Παικτών',CHtml::normalizeUrl(array('team/setPlayers')),


 'data' => 'js:{theIds : $.fn.yiiGridView.getSelection("addPlayers-grid")}',

 'success'=> 'function(html){$("#players-grid").html(html);$("#modalAddPlayers").modal("hide");}',


I have used the js: in the success parameter, which was wrong, as this was not acceptable. After changing this, all worked great. I could not find what caused the previous problem.



you are replacing the content of the element with the ID players-grid… and that’s why the DIV remains

Instead you need to replace it completely like


yes you are right, that was the problem, thank you