Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
260
Passing WeGrid Row object client side to server side and updating the server side data using csom and ajax
posted


Passing WebGrid row Object client side to server side and updating the server side data and displaying the server side data  in the webgrid(using AJAxX or refreshing the page).

My requirement:

WebGrid displayes the data.There are three columns. First two columns is having int value and thrid column is having the sum value for the same row.
User edits one column, that should upfdate the third column value as well as the data on server side.

Solution Approach:
1. Submit the data and add the data by iterating all the columns and update the list.
2. Use csom and pass the data(row) using smartsubmit and update the data on the serverside and refresh the page (AJAX)

Can you please help me to do the same using the second approach?

Parents
No Data
Reply
  • 2301
    posted

    Hi:

    You should set the cellValueChangeListener (attribute of cellEditing) to a server-side method like this:

    cellValueChangeListener="#{singleCellEditPageBean.editFired}"

    With this in place an AJAX call will be made to that method every time a cell's value is changed.

    To update your third column call dataBind from the server side method. For data bind to work, you must have a reference to the grid object.
    You create that by binding the grid in your JSP. For example:

    <ig:gridView binding="#{someBean.grid}" ...>

    On the server create an HtmlGrid object and create accessors for it.

    private HtmlGrid grid;

    public Htmlgrid getGrid() { return grid;}

    etc.

    With the grid reference in place, you can they dataBind like this:

    grid.dataBind();

    You can see an example of cellEditing, with complete source code, here:

    http://www.componentsforjsf.com/WebGridExamples/faces/examplePages/SingleCellEditOne.jsp
Children
No Data