为每一行在jQuery DataTable中的最后一列添加自定义按钮。

huangapple go评论60阅读模式
英文:

Add custom button to last column in every row in jquery DataTable

问题

我正试图重新创建在这里找到的示例DataTable Child Rows DataTables

DataTables运行正常,我没有收到“在行0,列4中请求未知参数'4'”的错误。
我的问题是按钮没有在最后一列中渲染。有人可以帮助我解决这个问题吗?谢谢!

这是我的Java Servlet逻辑...
为每一行在jQuery DataTable中的最后一列添加自定义按钮。

JavaScript代码:
为每一行在jQuery DataTable中的最后一列添加自定义按钮。

以及我的表格 -

                                <tr>
							        
							         <th>员工</th>
							         <th>班次</th>
							         <th>开始日期</th>
							         <th>结束日期</th>	
							       	 <th>详情</th>
					            </tr>
				           </thead>
				           <tfoot>
				           	<tr>
				           			
				           		     <th>员工</th>
							         <th>班次</th>
							         <th>开始日期</th>
							         <th>结束日期</th>
									 <th>详情</th>
					
				           </tr>
				           
				           </tfoot>
英文:

I am trying to recreate the example DataTable found here Child Rows DataTables

DataTables is working fine, I am not getting the - "Requested unknown parameter '4' for row 0, column 4" ERROR.
My problem is that the button is not rendering in the last column. Can somebody help me resolve this issue, Thanks!

Here is my java servlet logic..
为每一行在jQuery DataTable中的最后一列添加自定义按钮。

Javascript Code:
为每一行在jQuery DataTable中的最后一列添加自定义按钮。

And my Table -

                                <tr>
							        
							         <th>Employee</th>
							         <th>Shift</th>
							         <th>Start Date</th>
							         <th>End Date</th>	
							       	 <th>Details</th>
					            </tr>
				           </thead>
				           <tfoot>
				           	<tr>
				           			
				           		     <th>Employee</th>
							         <th>Shift</th>
							         <th>Start Date</th>
							         <th>End Date</th>
									 <th>Details</th>
					
				           </tr>
				           
				           </tfoot>

答案1

得分: 0

在渲染函数中,您需要返回一个字符串。因此,您只需要在按钮定义之前和之后添加单引号,就像这样:'<button>点击这里!</button>'

英文:

In the render function, you need to return a string. So you only need to add a single quote before and after your button definition, like this '<button>Click Here!</button>';

huangapple
  • 本文由 发表于 2020年8月26日 03:50:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/63586142.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定