Open dadinugroho opened 8 years ago
In addition, the bulk-delete is somewhat working. The delete is done but the reloading is hanging in reloading...
Hi John,
When I comment these two lines, it works. But javascript style confirm dialog was appeared instead of bootstrap modal.
[ 'class' => 'kartik\grid\ActionColumn', 'dropdown' => false, 'vAlign' => 'middle', 'urlCreator' => function($action, $model, $key, $index) { return Url::to([$action, 'id' => $key]); }, 'viewOptions' => ['role' => 'modal-remote', 'title' => 'View', 'data-toggle' => 'tooltip'], 'updateOptions' => ['role' => 'modal-remote', 'title' => 'Update', 'data-toggle' => 'tooltip'], 'deleteOptions' => ['role' => 'modal-remote', 'title' => 'Delete', // 'data-confirm' => false, // for overide yii data api // 'data-method' => false, // for overide yii data api 'data-request-method' => 'post', 'data-toggle' => 'tooltip', 'data-pjax' => '0', 'data-confirm-title' => 'Are you sure?', 'data-confirm-message' => 'Are you sure want to delete this item' ], ],
I have not been able to make it work with bootstrap modal yet.
Hi John,
I think I got the solution. The problem was with selectedIds. It is not defined on delete action, but used by the bulk delete.
` ... this.addFooterButton( okLabel === undefined ? this.defaults.okLabel : okLabel, 'submit', 'btn btn-primary', function (e) { var data;
// Test if browser supports FormData which handles uploads
-- if (window.FormData) {--
++ if (window.FormData && selectedIds != null) {++
data = new FormData($('#ModalRemoteConfirmForm')[0]);
data.append('pks', selectedIds.join());
} else {
// Fallback to serialize
data = $('#ModalRemoteConfirmForm');
data.pks = selectedIds;
data = data.serializeArray();
}
instance.doRemote(
dataUrl,
dataRequestMethod,
data
);
}
);
... `
By adding this, I can make an ajax post call. Still one more problem. the forceClose: true cannot close the modal in bullk delete.
Hi buddy
I faced the same problem.
Just comment these lines.
// Close the user input form
// $(this.footer).append('');
// if ($(this.content).find("form")[0] !== undefined) { // this.setupFormSubmit( // $(this.content).find("form")[0], // $(this.footer).find('[type="submit"]')[0] // ); // }
In my experience this happens when I change the id of the grid without changing the id of the corresponding ForceReload
Hi John,
I tried to install and generate a model using your yii2-ajaxcrud. The Update and View is working fine but not with delete. I tried in Firefox and Chrome but delete did not work for both. I like this extension so much, but I am really frustrated since delete is not working. I did not change anything on the code yet. The prompt message is pop up but when "Delete" button is clicked nothing is happened!
Can you help me on this?
I check with my ModalRemote.js
this.addFooterButton = function (label, type, classes, callback) { buttonElm = document.createElement('button'); buttonElm.setAttribute('type', type === null ? 'button' : type); buttonElm.setAttribute('class', classes === null ? 'btn btn-primary' : classes); buttonElm.innerHTML = label; var instance = this; $(this.footer).append(buttonElm); if (callback !== null) { $(buttonElm).click(function (event) { callback.call(instance, this, event); }); } };
Additionally, in chrome delete is also not working