Subversion Repositories DevTools

Rev

Rev 6650 | Rev 6695 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6650 Rev 6651
Line 432... Line 432...
432
            hide: { effect: 'fade', duration: opts.duration }
432
            hide: { effect: 'fade', duration: opts.duration }
433
            });
433
            });
434
    }
434
    }
435
}
435
}
436
 
436
 
-
 
437
//  Export Table as CSV support functions
-
 
438
//      Allow a table that has been tagged with a class of etable to be exported
-
 
439
// 
-
 
440
// Global variable for use of the table to CSV widget
-
 
441
// Used to convey info though the selection callback
-
 
442
//
-
 
443
var vixEtableData;
-
 
444
 
-
 
445
$( document ).ready(function() {
-
 
446
    vixEtableInit();
-
 
447
});
-
 
448
 
-
 
449
//      vixPostPageLoad is called when dynamic DOM elements are loaded 
-
 
450
function vixPostPageLoad(){
-
 
451
    vixEtableInit();
-
 
452
}
-
 
453
 
-
 
454
//  Init all elements marked with a class of 'etable'
-
 
455
//      Insert an icon
-
 
456
//      Remove original class so that the DOM can be scanned again
-
 
457
function vixEtableInit(){
-
 
458
    $('.etable').css('position', 'relative');
-
 
459
    $('.etable th:last-child').append(
-
 
460
            $('<img />')
-
 
461
                .attr({
-
 
462
                    title : "Export table as CSV",
-
 
463
                    src : "images/CopyToClipboard.ico",
-
 
464
                    height : "12px",
-
 
465
                    width : "12px",
-
 
466
                    hspace : "0px",
-
 
467
                    align : "absmiddle",
-
 
468
                    border : "0"
-
 
469
                    })
-
 
470
                .css({position : 'absolute', top : '0px', right : '0px'})
-
 
471
                .click(function(event){
-
 
472
                    vixEtableData =  $(this).closest('table');
-
 
473
                    var menu = '<div class="rex_clm" >&nbsp;Select Operation</div>';
-
 
474
                    menu += '<div class="mmItem" onClick="vixEtableProc(\'popup\');">Show in PopUp</div>';
-
 
475
                    menu += '<div class="mmItem" onClick="vixEtableProc(\'download\');">Download File</div>';
-
 
476
                    menu += '<div class="mmItem" onClick="vixEtableProc(\'clip\');">Copy to Clipboard</div>';
-
 
477
                    showmenu(event,menu);
-
 
478
                    event.stopImmediatePropagation();
-
 
479
                    event.stopPropagation();
-
 
480
                    return false;
-
 
481
                    })
-
 
482
        );
-
 
483
    $('.etable').addClass('etable-done').removeClass('etable');
-
 
484
}
-
 
485
 
-
 
486
//  Global function to support post-selection processing of CSV data
-
 
487
function vixEtableProc(mode) {
-
 
488
    var tdata = vixEtableData.data('etable')
-
 
489
    var defData = {
-
 
490
        delivery: mode,
-
 
491
        filename: 'data.csv',
-
 
492
        rowFilter: '.csvData'
-
 
493
        };
-
 
494
    $.extend(defData, tdata) ;
-
 
495
    var data = vixEtableData.TableCSVExport(defData);
-
 
496
    if ( mode == 'clip' ) {
-
 
497
        vixTextToClipBoard(data, {note : "CSV copied to Clipboard", duration : 1000});
-
 
498
    }
-
 
499
}
-
 
500
 
-
 
501
 
-
 
502
 
-
 
503
 
-
 
504
 
-
 
505
 
-
 
506
 
-
 
507