I have Issue when i select the action on select and coched all checkbox and click on ok not do anything this datatables contains the checkbox my following code :
function toggleChecks(obj)
{
$('.case').prop('checked', obj.checked);
}
$(document).ready(function() {
tablecontact = $('#table-contact').dataTable({
"info": true,
"aoColumns": [{ "sTitle": "<input type='checkbox' name='selectedContact[]' id='selectAll' onclick='toggleChecks(this);' ></input>", "mDataProp": null, "sWidth": "20px", "sDefaultContent": "<input type='checkbox' id="table-selected-<?=$this->idContact; ?>" value='<?=$this->idContact ;?>' class='case'></input>", "bSortable": false },null,null,null,null,null,null,null,null],
'sDom': 'lTfr<"clearfix">tip',
'oTableTools': {
'aButtons': []
} ,
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {//lien edition
$('td:eq(8)', nRow).html( '<a href="/<?=Zend_Registry::get('Zend_Locale')->getLanguage();?>/admin/contact-management/updatecontact/idContact/'+aData[0]+'"><b>'+aData[8]+'</b></a>' );
return nRow;
},
});
var tt = new $.fn.dataTable.TableTools( table );
$( tt.fnContainer() ).insertBefore('div.dataTables_wrapper');
and the select the action when i selected all checkbox i want do action and click ok but not work
<select name="table-action" id="table-action" class="small">
<option value="0">Appliquer à la sélection</option>
<option value="unsetemailnotification">UnsetEmailNotification</option>
</select>
<button type="submit" class="small" id="actionContact">Ok</button>
on my controller the following code :
:` public function setemailnotificationAction()
{
$ids = explode(';', $this->_request->getParam('listId',0));
$contact = new Admin_Model_DbTable_Contact();
if(!empty($ids))
{
foreach($ids as $id)
{
if(!$contact->setemailnotificationContact(intval($id)))
{
echo json_encode(array(
"response" => "false",
"errorMessage" => "Il y a eu une erreur dans l'activation de l'email notification: ". $id
));
exit();
}
}
));
exit();
}
exit();
}`
and i do that on .phtml :
$('#actionContact').click(function(){
var confirmAction = true;
var listId = '';
var selectAction = $("#table-action").val();
$(".sorting_1").find(':checkbox:checked').each(function(){
if(listId.length == 0){
listId += $(this).val();
}else{
listId += ";" + $(this).val();
}
});
});
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire