An error has occurred - Please contact the system administrator
An error has occurred - Please contact the system administrator
sharadneo1
Posts: 16Questions: 1Answers: 0
Hi All,
i am using editor for crud operation. When i add , update and delete i use to get this "message An error has occurred - Please contact the system administrator" but not always and i tried to debug but not getting any error on console on chrome, and there is no issue in functionality its working fine. only the issue i am getting that error message on below of dialogue box.
Could you suggest me how to resolve.
Thanks in advance
sharad
i am using editor for crud operation. When i add , update and delete i use to get this "message An error has occurred - Please contact the system administrator" but not always and i tried to debug but not getting any error on console on chrome, and there is no issue in functionality its working fine. only the issue i am getting that error message on below of dialogue box.
Could you suggest me how to resolve.
Thanks in advance
sharad
This discussion has been closed.
Replies
Allan
Allan
function drawTable(){
// axesGroupTable.fnClearTable();
// axesGroupTable.fnAddData();
axesGroupTable.fnDraw();
}
// use a global for the submit and return data rendering in the examples
var axesGroupEditor;
var axesGroupTable;
$(document).ready(function() {
// Create the form
axesGroupEditor = new $.fn.dataTable.Editor( {
"bProcesing" : true,
"ajaxUrl" : "/ECE/axesGroup",
"domTable" : "#axesGroup",
"fields" : [ {
"label" : "Axes Group:",
"name" : "axesGroupTitleText",
"type" : "text"
}
]
} );
// New record
$('#add').on('click', function (e) {
e.preventDefault();
axesGroupEditor.create(
'Add New',[
{
"label": "Cancel" ,
"fn": function ()
{
this.close();
}
},
{
"label": "Add",
"fn": function ()
{
axesGroupEditor.submit(),
this.close(),
drawTable();
} }
]
);
} );
// Edit record
$('#axesGroup').on('click', 'a.editor_edit', function (e) {
e.preventDefault();
axesGroupEditor.edit(
$(this).parents('tr')[0],
'Edit record',
{
"label": "Update",
"fn": function ()
{
axesGroupEditor.submit(),
this.close(),
drawTable();
} }
);
} );
// Remove record
$('#axesGroup').on('click', 'a.editor_remove', function (e) {
e.preventDefault();
axesGroupEditor.message( "Are you sure you want to delete this entry?" );
axesGroupEditor.remove(
$(this).parents('tr')[0],
'Delete row',
{
"label": "Ok",
"fn": function ()
{
axesGroupEditor.submit(),
this.close(),
drawTable();
} }
);
} );
// DataTables init
axesGroupTable = $("#axesGroup").dataTable({
"sPaginationType": "scrolling",
"bProcesing" : true,
"bServerSide" : true,
"bLenthChange" : true,
"iDisplayLength" : 10,
"sScrollY" : "300px",
"sAjaxSource" : '/ECE/getAxesGroups',
"bSort" : false,
"bFilter" : false,
"aoColumns" : [
{
"sTitle" : "Axes Groups",
"mData" : "axesGroupTitleText"
},
{
"mData": null,
"sClass": "right",
"sDefaultContent": ' '
}
],
"fnServerData" : function(sSource, aoData, fnCallback) {
$.ajax({
"dataType" : 'json',
"type" : "GET",
"url" : sSource,
"data" : aoData,
"success" : function(data,textStatus,jqXHR)
{
fnCallback(data);
}
});
},
"sPaginationType" : "full_numbers"
});
} );
//This is my controller
package com.deere.eceweb.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.deere.ece.domain.AxesGroup;
import com.deere.ece.form.AxesGroupMaintainForm;
import com.deere.ece.service.ConfigurationService;
import com.deere.ece.util.ApplicationUtil;
@Controller(value = "maintainAxesGroupsController")
public class MaintainAxesGroupsController {
@Resource(name = "configurationService")
private ConfigurationService configurationService;
/** The Logger. */
public final static Logger logger = LoggerFactory
.getLogger(MaintainAxesGroupsController.class);
@RequestMapping(value = { "/axesGroups" }, method = RequestMethod.GET)
public String viewBaseLineText(Model model) {
return "MaintainAxesGroup";
}
@RequestMapping(value = "/getAxesGroups", method = RequestMethod.GET )
public @ResponseBody
String getAxesGroups(@RequestParam int iDisplayStart,
@RequestParam int iDisplayLength, @RequestParam int sEcho)
throws IOException {
DataTablesTO dt = new DataTablesTO();
List axesGroupDmList = configurationService.getAllAxesGroups();
List axesGroupDmListPage = configurationService.getAllAxesGroupsPage(iDisplayStart,iDisplayLength);
List axesGroupFormList = new ArrayList();
for (AxesGroup axesGroup : axesGroupDmListPage) {
AxesGroupMaintainForm axesGroupForm = new AxesGroupMaintainForm();
axesGroupForm.setAxesGroupId(axesGroup.getAxesGroupId());
axesGroupForm.setAxesGroupTitleText(axesGroup.getAxesGroupTitleText());
axesGroupForm.setAxesGroupGUIDText(axesGroup.getAxesGroupGUIDText());
axesGroupForm.setDt_RowId(axesGroup.getAxesGroupId().toString());
axesGroupFormList.add(axesGroupForm);
}
// this is the dataset reponse to client
dt.setAaData(axesGroupFormList);
// // the total data in db for datatables
dt.setiTotalDisplayRecords(axesGroupDmList.size());
// to calculate page no. and position the total data in db for datatables to calculate page no.
dt.setiTotalRecords(axesGroupDmList.size());
dt.setsEcho(sEcho);
return toJson(dt);
}
private String toJson(DataTablesTO<?> dt) throws IOException {
ObjectMapper mapper = new ObjectMapper();
String jsonData = null;
try {
jsonData = mapper.writeValueAsString(dt);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
logger.info(">>>>>" +jsonData);
return jsonData;
}
@RequestMapping(value = "/axesGroup", params = "action=create", method = RequestMethod.POST )
String createAxesGroup(
@RequestParam(value = "data[axesGroupTitleText]", required = false) String axesGroup,
HttpServletRequest request) {
AxesGroupMaintainForm axesGroupForm = new AxesGroupMaintainForm();
axesGroupForm.setAxesGroupTitleText(axesGroup);
axesGroupForm.setAxesGroupGUIDText(ApplicationUtil.getConfigurationId());
configurationService.addAxesGroup(axesGroupForm);
return "MaintainAxesGroup";
}
@RequestMapping(value = "/axesGroup", params = "action=edit", method = RequestMethod.POST )
String editAxesGroup(
@RequestParam(value = "data[axesGroupTitleText]", required = false) String axesGroup,
@RequestParam(value = "id", required = false) String editRowid,
HttpServletRequest request) {
AxesGroupMaintainForm axesGroupForm = new AxesGroupMaintainForm();
axesGroupForm.setAxesGroupId(Integer.valueOf(editRowid));
axesGroupForm.setAxesGroupTitleText(axesGroup);
configurationService.updateAxesGroup(axesGroupForm);
return "MaintainAxesGroup";
}
@RequestMapping(value = "/axesGroup", params = "action=remove", method = RequestMethod.POST )
String removeAxesGroup(
@RequestParam(value = "data[axesGroupTitleText]", required = false) String axesGroup,
@RequestParam(value = "data[]", required = false) String deleteRowId,
HttpServletRequest request) {
configurationService.deleteAxesGroupById(Integer.valueOf(deleteRowId));
return "MaintainAxesGroup";
}
}
Allan
Thanks alot - sharad :)