سؤال

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