ParamQuery grid support forum
General Category => Help for ParamQuery Grid (free version) => Topic started by: mohta.kam on October 27, 2020, 10:17:01 pm
-
When I create a new record in the grid it does not have a productid. My database insert statement creates and returns it. How do I update the grid with that productid?
Note: I do not want to refresh the entire grid - only the new record. i have checked the batch editing example but failed to understand in below code how dlist is gets the productid before returning the response.
@RequestMapping(value="/products/batch", method=RequestMethod.POST)
public @ResponseBody String batch(@RequestParam String list, HttpServletRequest request ){
HttpSession ses = fillInSession(request);
Map dlist = deserializeMap(list);
ArrayList updateList = (ArrayList)dlist.get("updateList");
ArrayList addList = (ArrayList)dlist.get("addList");
ArrayList deleteList = (ArrayList)dlist.get("deleteList");
this.updateList(updateList, ses);
this.addList(addList, ses);
this.deleteList(deleteList, ses);
return serializeMap(dlist);
}
Please help.
-
New ProductID is set in the addList method.
public void addList(ArrayList addList, HttpSession ses ){
List<Product> products = (List<Product>)ses.getAttribute("Products");
int max = getMaxProductID(products);
for (int i = 0; i < addList.size(); i++)
{
Product addProduct = (Product)addList.get(i);
addProduct.setProductID(max+1+i);
products.add(addProduct);
}
}
-
But products object is neither returned and neither used.