Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This .on() needs jquery 1.7 I think.
- $("a.action:not(.remove)").on("click", function (e) {
- e.preventDefault();
- var obj = $(this),
- objD = obj.data();
- if ( !$(this).hasClass('disablelink') ) {
- var machineIds = getSelection( obj, objD );
- if ( machineIds.length > 0 ) {
- packageAction( objD.ajaxPackageid, machineIds, objD.ajaxType );
- };
- }
- $(".checkall").attr("checked", false);
- });
- function getSelection( obj, objD ) {
- var selected = new Array();
- if ( objD.ajaxMachineId ) {
- selected.push( objD.ajaxMachineId );
- } else {
- $("input.checkbox:checkbox:checked:not(.checkall)").each(function () {
- var checkbox = $(this),
- machineId = checkbox.val(),
- packageId = objD.ajaxPackageid.removeSpecialChars().toUpperCase(),
- operation = objD.ajaxType;
- if ( $("#" + machineId + packageId + "").size() != 0 ) {
- var row = $("#" + machineId + packageId + "");
- row.has("a[data-ajax-type=" + operation + "]:not(.hide)").length ? selected.push(machineId) : checkbox.attr('checked', false);
- }
- });
- }
- return selected;
- }
- function packageAction(packageId, machineIds, operationType) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement