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