@@ -433,7 +433,7 @@ PivotView.prototype._getSelectedText = function () {
433433 * @param {event } event
434434 * @param {function } [drillThroughHandler]
435435 */
436- PivotView . prototype . _cellClickHandler = function ( cell , x , y , event , drillThroughHandler ) {
436+ PivotView . prototype . _cellClickHandler = function ( cell , x , y , event , drillThroughHandler , data ) {
437437
438438 var data = this . controller . dataController . getData ( ) ,
439439 f = [ ] , f1 , f2 , callbackRes = true , result ,
@@ -473,21 +473,73 @@ PivotView.prototype._cellClickHandler = function (cell, x, y, event, drillThroug
473473 callbackRes = this . controller . CONFIG . triggers [ "cellDrillThrough" ] ( {
474474 event : event ,
475475 filters : f ,
476- cellData : cell
477- } ) ;
476+ cellData : cell ,
477+ x : x ,
478+ y : y
479+ } , data ) ;
478480 }
479481 if ( typeof drillThroughHandler === "function" ) {
480482 callbackRes = ! ( ! ( false !== drillThroughHandler ( {
481483 event : event ,
482484 filters : f ,
483- cellData : cell
484- } ) ) || ! ( callbackRes !== false ) ) ;
485+ cellData : cell ,
486+ x : x ,
487+ y : y
488+ } , data ) ) || ! ( callbackRes !== false ) ) ;
485489 }
486490 if ( callbackRes !== false ) this . controller . tryDrillThrough ( f ) ;
487491 }
488492
489493} ;
490494
495+ PivotView . prototype . listingClickHandler = function ( params , data ) {
496+
497+ if ( data . info . leftHeaderColumnsNumber !== 0 ) {
498+ console . warn ( "Listing handler called not for a listing!" ) ;
499+ return ;
500+ }
501+
502+ var self = this ,
503+ el = function ( e ) { return document . createElement ( e ) ; } ,
504+ d1 = document . createElement ( "div" ) ,
505+ headers = data . rawData [ 0 ] . map ( function ( v ) {
506+ return v . value + ( v . source && v . source . title ? "(" + v . source . title + ")" : "" ) ;
507+ } ) ,
508+ values = data . rawData [ params . y ] . map ( function ( v ) { return v . value ; } ) ;
509+
510+ d1 . className = "lpt-hoverMessage" ;
511+ d1 . style . fontSize = "12pt" ;
512+ d1 . style . opacity = 0 ;
513+
514+ var h , val , hr ;
515+ for ( var i = 0 ; i < headers . length ; i ++ ) {
516+ h = el ( "div" ) ; val = el ( "div" ) ; hr = el ( "hr" ) ;
517+ h . className = "lpt-messageHead" ;
518+ h . textContent = headers [ i ] ;
519+ val . className = "lpt-messageBody" ;
520+ if ( values [ i ] !== "" )
521+ val . textContent = values [ i ] ;
522+ else
523+ val . innerHTML = " " ;
524+ d1 . appendChild ( h ) ;
525+ d1 . appendChild ( val ) ;
526+ d1 . appendChild ( hr ) ;
527+ }
528+
529+ this . elements . base . appendChild ( d1 ) ;
530+
531+ setTimeout ( function ( ) {
532+ if ( d1 ) d1 . style . opacity = 1 ;
533+ } , 1 ) ;
534+ d1 . addEventListener ( this . controller . CONFIG [ "triggerEvent" ] || "click" , function ( ) {
535+ if ( self . _getSelectedText ( ) ) return ;
536+ self . removeMessage ( ) ;
537+ } ) ;
538+
539+ return false ;
540+
541+ } ;
542+
491543/**
492544 * Display hovering message.
493545 *
@@ -1295,7 +1347,7 @@ PivotView.prototype.renderRawData = function (data) {
12951347 td . addEventListener ( CLICK_EVENT , ( function ( x , y , cell ) {
12961348 return function ( event ) {
12971349 _ . _cellClickHandler . call (
1298- _ , cell , x , y , event , info . drillThroughHandler
1350+ _ , cell , x , y , event , info . drillThroughHandler , data
12991351 ) ;
13001352 } ;
13011353 } ) ( x , y , rawData [ y ] [ x ] ) ) ;
0 commit comments