My requirement is to do read, update, delete & insert operations of datas from DB using front end as DOJO & Spring MVC.
I am able to fetch the records from db and display in DOJO Enhanced Grid(Editable Grid). On editing the grid data, I don't know how to send the Grid Store Items to my Spring Controller and Update/Insert/Delete in my DB.
Here is the code I have tried to fetch the data from java controller to front end.
Controller Class
@RequestMapping(value="eiaProjectSummary", produces = "application/json")
public @ResponseBody Map<String, Object> getEIAProjectSummary(
@RequestParam(required = true) String prodGroupId,
@RequestParam(required = true) List<Integer> eiaValues
) {
Map<String, Object> returnList = new HashMap<String, Object>();
List<PCPTAnalysisBean> pcptList = //getting the list of records from DB.
returnList.put("eiaProjSummaryList", pcptList);
return returnList;
}
Javascript
dojo.xhrGet({
url: "pcptAnalysis/eiaProjectSummary.json?prodGroupId="+ prodGrpId +"&eiaValues="+eiaValues,
handleAs: "json",
preventCache: true,
load: function(response) {
var resultsGrid = new dojo.data.ItemFileReadStore({
data: {
items:response.eiaProjSummaryList
}
});
grid = new dojox.grid.EnhancedGrid({store: resultsGrid,
structure: layout,
selectionMode: "multiple",
rowSelector: '0px'
});
}
});
Similarly, I need to send the edited Grid Store Items from Javascript to My Controller Class. I don't know how to send my Grid Store data from javascript ajax post and how to receive it in my Controller class method. Kindly help me.