Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 83168

Fancy Box with ReadOnly Data Issues - Pulling Data From Cells

$
0
0
Hey guys!

We are having an issue with the Fancy Box plugin, we are using DataTables to put information into a Fancy Box from the tables themselves. We want to be able to pull specific names, depending on the row a person is selecting and display the information in the fancy box. For example:
Select 'John Appleseed' -> Fancybox Pops up with more information -> Displays name, telephone number, address, etc.

The problem comes in where we can't get fancybox to display the data properly or dynamically with DataTables. Is there a specific way we should approach this? I will display the code we are using for the FancyBox along with different failed attempts we have tried in the past.

"aoColumns": [
			{ "mData": null, "sClass": "center", "sDefaultContent": '<a href="#fancybox-static" class="fancybox"><div class="icon-user"></div></a>'},
			{ "mData": "name", "sClass": "center"   },
			{ "mData": "hotel", "sClass": "center"  },
			{ "mData": "total", "sClass": "center"  },
			{ "mData": "time", "sClass": "center", "bVisible": false  }
		],
		"oTableTools": {
			"sRowSelect": "single",
			//"fnRowSelected": function(node){
              //  aData = myTable.fnGetData(node[1]); //nice array of cell values
                //if(aData[0]=='Delivery') return ;
                //$("name").val(aData[1]);          
            //},

That is the columns and TableTools part we are using to try and call the specific cell data.

//"fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
		//	testRow = nRow;
		//	testName = aData['name'];
		//},
		"fnDrawCallback": function () { 
		//testRow = myTable.fnGetData(this)[1]; 
		//var anTds = fnGetTds( $('#product-table thead tr:eq(1)')[0] ); 
		// var oTT = TableTools.fnGetInstance( 'product-table' );
   		 //var aData = oTT.fnGetSelectedData();
//   		 $("#product-table tbody tr").click(function() {
//var position = searchTable.fnGetPosition(this); // getting the clicked row position
//var contactId = searchTable.fnGetData(position)[1]; // getting the value of the first (invisible) column
//});
		$(".fancybox").fancybox({
			//'title': '' + contactId,
			'maxWidth': 600,
        	'maxHeight': 250,
        	//'href': 'http://hotelservedev.jvgames.com:8060',
        	'fitToView': true,
        	'width': '60%',
       	 	'height': '60%',
        	'autoSize': false,
        	'closeClick': false,
        	'openEffect': 'elastic',
        	'closeEffect': 'elastic',
        	'openSpeed': 'slow',
        	'openEasing': 'swing',
        	'type': "html",
        	'helpers' : {
        		'overlay' : {
            		'css' : {
                		'background' : 'rgba(37, 37, 38, 0.65)',
                		'margin-bottom' : '300px',
                		'background-size' : '100%'
            		}
        		}
   		 	},
   		 	'content' : '<div id="fancybox-static" class="fancybox-title-float-inner"><div id="fancy-title" class="fancybox-title-float-inner">customer details</div><div class="row1"><p class="lowerStyle">Name: <b><?php echo $leave ?></b><br>Cust ID: <b>#1234</b></p><p class="lowerStyle">Credit Card: <b>****-****-****-1234</b><br><span class="tab">Exp: <b>6/13</b></span>CV: <b>123</b></p><p class="lowerStyle">Phone: <b>+1-702-123-1234</b></div><div class="row2"><p class="lowerStyle">Check-in: <b>9/13/13</b><br>Check-out: <b>10/13/13</b></p><br><p class="lowerStyle">Billing Address: <br><b>1234 Rainbow Lane.<br>Las Vegas, NV 89147-4114</b></p></div></div>'
    	});

This is the fancy box code with the call backs to attempt to get the names themselves. The problem comes in when we try to put a dynamic jQuery variable in the content section of fancybox, we get errors of undefined or it sits at processing. Any help is appreciated! Thank you!

Viewing all articles
Browse latest Browse all 83168

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>