문제

In my view I want to be able to delete and update my listview with ajax. Now, both links work right if the other one is not there. If they're both there, the both fire the actionUpdate. Does anyone know why the delete action isn't fired anymore ?

    <div class="delete">
    <?php
    echo CHtml::ajaxLink(
        '<img src="handig/ikoons/delete.png" width="20"/>',
        array("plaatjes/delete","id"=>$data->id),
        array(
            "beforeSend" => "js:function(){ return confirm('Confirm ?') }",
            "success"=>'js:function(data){ $.fn.yiiListView.update("post_list"); }',
            "type"=>"post",
        ),
        array("id"=>$data->id)
    ); ?>              
    </div>

    <div class="edit">
    <?php
    echo CHtml::ajaxLink(
        '<img src="handig/ikoons/edit.png" width="20"/>',
        array("plaatjes/update","id"=>$data->id, "pad"=>$data->pad),
        array(
            'data'=>array('Plaatjes'=>'data'),
            "success"=>'js:function(data){ $.fn.yiiListView.update("post_list"); }',
            "type"=>"post",
        ),
        array("id"=>$data->id)
    ); ?>              
    </div>
도움이 되었습니까?

해결책

Problem on your HTMLOptions array . You are duplicate the ID

array("id"=>$data->id) 

on both links . change or remove this

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top