[removed]
<!--
var listenerFieldsEditCount = 0;
jq(function(){
_listener_event_type=jq('#listenerEventType').combobox({
editable:false
});
_task_listener_fields_dg=jq('#task-listeners-fields-list').datagrid({
//title:"Listener",
//url:'${ctx}/wf/procdef/procdef!search.action',//加载表格数据的URL
singleSelect:true,
width:600,
height:300,
iconCls:'icon-edit',
//fit:true,
//idField:'id',
//pagination:true,
//pageSize:15,
//pageNumber:1,
//pageList:[10,15],
rownumbers:true,
//sortName:'id',
//sortOrder:'asc',
striped:true,
toolbar:[{
text:'New',
iconCls:'icon-add',
handler:function(){
if(listenerFieldsEditCount>0){
jq.messager.alert("error","有可编辑的单元格,不能添加!",'error');
return;
}
jq('#task-listeners-fields-list').datagrid('appendRow',{
id:'',
fieldName:'',
type:'',
value:'',
action:''
});
var index = jq('#task-listeners-fields-list').datagrid('getRows').length-1;
jq('#task-listeners-fields-list').datagrid('beginEdit', index);
}
}],
onDblClickRow:function(rowIndex,rowData){
editListenerField(rowIndex);
},
onBeforeEdit:function(index,row){
row.editing = true;
jq(this).datagrid('refreshRow', index);
listenerFieldsEditCount++;
},
onAfterEdit:function(index,row){
row.editing = false;
jq(this).datagrid('refreshRow', index);
listenerFieldsEditCount--;
},
onCancelEdit:function(index,row){
row.editing = false;
jq(this).datagrid('refreshRow', index);
listenerFieldsEditCount--;
}
});
jq('#fieldSaveBt').linkbutton({
iconCls:"icon-save"
});
jq('#fieldCancelBt').linkbutton({
iconCls:"icon-cancel"
});
jq("#listenerServiceClass").autocomplete(_process_def_provided_listeners, {
width: 450,
minChars: 0,
max: 10,
autoFill: true,
mustMatch: false,
matchContains: false,
scrollHeight: 220,
//multiple: true,
//multipleSeparator: " ",
scroll: true
});
populateListenerProperties();
});
function changeListenerServiceType(obj){
if(obj.value=='javaClass'){
jq('#listenerServiceLabel').html('Service Class:');
jq('#listenerServiceClass').show();
jq('#listenerServiceExpression').hide();
}else if(obj.value=='expression'){
jq('#listenerServiceLabel').html('Expression:');
jq('#listenerServiceClass').hide();
jq('#listenerServiceExpression').show();
}
}
function listenerFieldsActionFormatter(value,rowData,rowIndex){
var id = rowIndex;
var s='<img onclick="saveListenerField('+id+')" src="../../image/ok.png" title="'+"确定"+'" style="cursor:hand;"/>';
var c='<img onclick="cancelListenerField('+id+')" src="../../image/cancel.png" title="'+"取消"+'" style="cursor:hand;"/>';
var e='<img onclick="editListenerField('+id+')" src="../../image/modify.png" title="'+"修改"+'" style="cursor:hand;"/>';
var d='<img onclick="deleteListenerField('+id+')" src="../../image/delete.gif" title="'+"删除"+'" style="cursor:hand;"/>';
if(rowData.editing)
return s;
else
return e+' '+d;
}
function cancelListenerField(id){
_task_listener_fields_dg.datagrid('cancelEdit', id);
}
function editListenerField(id){
_task_listener_fields_dg.datagrid('beginEdit', id);
}
function saveListenerField(id){
//alert(id);
_task_listener_fields_dg.datagrid('endEdit', id);
//alert(editcount);
}
function deleteListenerField(id){
_task_listener_fields_dg.datagrid('deleteRow',id);
refreshAllListenerFields();
}
function refreshAllListenerFields(){
var rs = _task_listener_fields_dg.datagrid('getRows');
for(var i=0;i0){
jq.messager.alert("error","",'error');
return null;
}
var insertRows = _task_listener_fields_dg.datagrid('getChanges','inserted');
var updateRows = _task_listener_fields_dg.datagrid('getChanges','updated');
var deleteRows = _task_listener_fields_dg.datagrid('getChanges','deleted');
var changesRows = {
inserted : [],
updated : [],
deleted : []
};
if (insertRows.length>0) {
for (var i=0;i0) {
for (var k=0;k0) {
for (var j=0;j0){
jq.messager.alert("error","请先保存可编辑的表格!",'error');
return;
}
if(listenerId != "" && listenerId != null && listenerId!="null"&&listenerId;!="NULL"){
var listener = getExsitingListener();
var r = updateExistingListener(listener);
if(!r)return;
}else{
var listener = createNewListener();
var r = insertNewListener(listener);
if(!r)return;
}
_listener_win.window('close');
}
function insertNewListener(listener){
listener.event=_listener_event_type.combobox('getValue');
jq('input[name="listenerServiceType"]').each(function(i){
if(this.checked){
listener.serviceType=this.value;
return false;
}
});
listener.serviceClass=jq('#listenerServiceClass').val();
listener.serviceExpression=jq('#listenerServiceExpression').val();
var changesRows = getListenerFieldsGridChangeRows();
if(changesRows == null)return false;
var insertRows = changesRows['inserted'];
if (insertRows.length>0) {
for (var i=0;i0) {
for (var i=0;i0) {
for (var k=0;k0) {
for (var j=0;j<deleteRows.length;j++) {
listener.deleteField(deleteRows[j].id);
}
}
loadTaskListeners();
return true;
}
function populateListenerProperties(){
if(listenerId != "" && listenerId != null && listenerId!="null"&&listenerId;!="NULL"){
var listener = task.getTaskListener(listenerId);
_listener_event_type.combobox('setValue',listener.event);
var serviceType = listener.serviceType;
jq('input[name="listenerServiceType"]').each(function(i){
if(this.value==serviceType){
this.checked=true;
changeListenerServiceType(this);
if(this.value=='javaClass'){
jq('#listenerServiceClass').val(listener.serviceClass);
}else if(this.value=='expression'){
jq('#listenerServiceExpression').val(listener.serviceExpression);
}
return false;
}
});
var fields = listener.fields;
var _listener_fields_grid_data=[];
for(var i=0;i<fields.getSize();i++){
var field = {
id:fields.get(i).id,
fieldName:fields.get(i).name,
type:fields.get(i).type,
value:fields.get(i).value,
action:''
};
_listener_fields_grid_data[i]=field;
}
_task_listener_fields_dg.datagrid('loadData',_listener_fields_grid_data);
}
}
function closeTaskListenerWin(){
_listener_win.window('close');
}
//-->
[removed]
Event:
Create
Assignment
Complete
All
<input type="radio" id="listenerServiceType" name="listenerServiceType" value="javaClass" checked="checked" Class
<input type="radio" id="listenerServiceType" name="listenerServiceType" value="expression"
Service Class:
<input type="text" id="listenerServiceClass" name="listenerServiceClass" size="80" value=""/>
<input type="text" id="listenerServiceExpression" name="listenerServiceExpression" size="80" none;" value=""/>
Fields:
Field Name
Type
Value
Action
<a href="##" id="fieldSaveBt"
<a href="##" id="fieldCancelBt"