我正在使用播放 1.2.5。在我的一个观点中,我有一个数据表,其中一列是可编辑的。为此,我使用 jquery.dataTables.js 和 jquery.jeditable.js 插件。
现在,当我在字段中输入新值时,ajax 调用出现问题。我创建了一个动作,每次编辑一行时都应该调用它,但这不起作用。不会调用该操作,有人可以看到我的错误吗?
谢谢
这是我的行动,首先我想看看它被称为
public static void configurationChange(SendAllSysParameter para){
Logger.info( "incoming configuration change", null );
}
这是我的看法:
#{extends 'main.html' /}
#{set title:'Sendall Configuration Page' /}
#{script 'jquery.dataTables.js'/}
#{stylesheet 'demo_page.css' /}
#{stylesheet 'jquery.dataTables.css' /}
#{script 'jquery.jeditable.js' /}
<div class="pdx_std_north_panel">
<table id="table_id" class="display">
<thead>
<th>Property</th>
<th>Value</th>
</thead>
<tbody>
#{list items:paras, as:'elem' }
<tr id="${elem.sendAllKey}">
<td id="${elem_index}">${elem.sendAllKey}</td>
<td id="${elem_index}">${elem.sendAllValue}</td>
</tr>
#{/list}
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function(){
var oTable = $('#table_id').dataTable();
//alert("Test2");
var configurationChangeRoute = #{jsRoute @Application.configurationChange(':element') /};
console.log('configurationChangeRout mit jsRoute-Tag: ' + configurationChangeRoute.url);
var configurationChangeAction = #{jsAction @Application.configurationChange(':element')/};
console.log('configurationChangeAction mit jsActionTag: ' + configurationChangeAction);
//alert(configurationChangeRoute.url);
//alert(configurationChangeAction);
/* Apply the jEditable handlers to the table */
$('td:eq(1)', oTable.fnGetNodes()).editable( configurationChangeAction, {
"callback": function( sValue, y ) {
console.log('callback with svalue ' + sValue + ' and y ' + y);
var aPos = oTable.fnGetPosition( this );
oTable.fnUpdate( sValue, aPos[0], aPos[1] );
},
"submitdata": function ( value, settings ) {
console.log('submitdata');
return {
"row_id": this.parentNode.getAttribute('id'),
"column": oTable.fnGetPosition( this )[2]
};
},
"height": "14px"
} );
我的模型:
package models;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import play.db.jpa.GenericModel;
import play.db.jpa.Model;
@Entity
@Table(name="SendAll_SysParameter")
public class SendAllSysParameter extends GenericModel
{
@Id
@Column(name = "sendAllKey", unique = true, nullable = false)
public String sendAllKey;
@Column(name = "sendAllValue")
public String sendAllValue;
@Column(name = "sendAllDate", nullable = false, length = 23)
public Timestamp sendAllDate;
}