2014-04-11 8 views
1

CGridView을 사용하여 Object라는 모델에서 생성 된 테이블을 표시하고 있습니다. 확인란을 선택한 다음 제출 컨트롤러의 만들기 작업으로 이동하여 선택한 행의 ID를 사용하려고합니다. 나는 $.fn.yiiGridView.getChecked 함수를 사용할 수 있다고 읽었지만 작동하지 않습니다.Yii - CHtml :: ajaxLink - TypeError : 설정이 정의되지 않았습니다.

<?php 
$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'Object', // the containerID for getChecked 
    'dataProvider'=>$dataProvider, 
    'columns'=>array(
     array(
      'class'=>'CCheckBoxColumn', 
      'id'=>'example-check-boxes' // the columnID for getChecked 
     ), 
     array(
      'name'=>'object_name', 
      'type'=>'text', 
     ), 
//more columns  
    ), 
)); 
?> 
<?php 
    echo CHtml::ajaxLink('Next',Yii::app()->createUrl('submission/create'), 
     array(
      'type'=>'POST', 
      'data'=>'js:{theIds : $.fn.yiiGridView.getChecked("object","example-check-boxes").toString()}' 
     ) 
    ); 
?> 

답변

0

변경이 :

'data'=>'js:{theIds : $.fn.yiiGridView.getChecked("object","example-check-boxes").toString()}' 

이 사람 :

'data'=>'js:{theIds : $.fn.yiiGridView.getChecked("Object","example-check-boxes").toString()}' 

당신은 쓰기 않았다 방화범에 의해 표시되는 오류가

TypeError: settings is undefined 
...s).children('tbody').children('tr').children('td').children('input[name="' + col... 

내보기입니다 object 그러나 I 있는 gridview의 D는 O.

+0

감사합니다 자본, Object,하지만 지금은 다음과 같은 오류가 발생합니다 : POST에 http : // localhost를/출판/SRC/웹/제출/ \t 400 잘못된 요청 를 만들 \t \t 100ms js_b27 ... 25ed.js (라인 304) "NetworkError : 400 잘못된 요청 - http : // localhost/publications/src/web/submission/create" – Ilia

+0

URL이 유효하지 않은 경우가 많습니다. – Michiel

+0

URL이 유효하고 액세스 할 수 있습니다. Firebug에서 오류를 확장하면 다음과 같은 결과도 얻습니다. CSRF 토큰을 확인할 수 없습니다. – Ilia

관련 문제