Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1817

Problem with mRender and Server-Side code

$
0
0
I just converted all my tables from using dynimcally built aoColumns to using aoColumnDefs.

My new table I am adding needs the last row to have a single button in each.

The tables are all initialized the same way and they use this function to define the aoColumnDefs:
		function build_aoColumnDefs(tableID){
			aoColDefs = [
						{	"mData":0,
							"mRender": function(data, type, full){
							   //create_assign_button(data);
							   //console.log(type); console.log(full);
							   return '<a href="'+data+'">Download</a>';
							},
							"aTargets":["assign_button"]
						},
						 {"bVisible": false, "aTargets":["hidden"]},
						 {"bSearchable": false, "aTargets":["NoSearch"]},
						 {"bSearchable": true, "aTargets":["_all"]},
						 {"bVisible": true, "aTargets":["_all"]}
						 
						 ];
			return aoColDefs;
		}

Here is the table:
				<div id="<?php echo($tabID[5]);?>" style="text-indent:20px;">
					<div id="container">
						<div id="dynamic">
							<table class="display" id="<?php echo($tableID[5]);?>">
								<thead>
									<tr>
										<th rowspan="1">FirstName</th>
										<th rowspan="1">LastName</th>
										<th rowspan="1">UserName</th>
										<th rowspan="1">Grade</th>
										<th rowspan="1">AssetTag</th>
										<th rowspan="1">Location</th>
										<th rowspan="1" class=''>Status</th>
										<th rowspan="1" class="assign_button">Assign</th>
										
									</tr>
								</thead>
								<tbody>
									<tr>
										<td colspan="7" class="dataTables_empty">Loading data from server</td>
									</tr>
								</tbody>
								<tfoot>
									<tr>
                                        <th id="FirstName" 	class=''><input type="text" id="OUT0" value="First Name" class="search_init" /></th>
										<th id="LastName" 	class=''><input type="text" id="OUT1" value="Last Name" class="search_init" /></th>
										<th id="UserName" 	class=''><input type="text" id="OUT2" value="User Name" class="search_init" /></th>
										<th id="Grade" 		class=''><input type="text" id="OUT3" value="Grade" class="search_init" /></th>
										<th id="AssetTag" 	class=''><input type="text" id="OUT4" value="Asset" class="search_init" /></th>
										<th id="Location" 	class=''><input type="text" id="OUT5" value="Location" class="search_init" /></th>
										<th id="Status" 	class=''></th>
										<th id="Assign" 	class=''></th>
                                    </tr>
								</tfoot>
							</table>
						</div>
					</div>
				</div>

The anonymous function never fires during render. And I get a warning since the json data being generated is from a server-side script that only returns 7 values. I thought mData and mRender would fix this but like I said, the aTarget by class never seems to trigger for some reason.

I need to get this working by Monday at the latest. Could you help me out again :-)

Thanks!
Bil

Viewing all articles
Browse latest Browse all 1817

Trending Articles