Hi All,
First of all i would like to thank you all for your previous valuable suggestions. Currently i am working on JSF application where we used infragistics gridView component. The problem concern is initially when the JSF page is loaded we will display a list of records by specifying the datasource of the ig:gridView.
Now my question is, when the user updates a specific record from the list how to capture only those updated specific records??
Currently i am using gridView.getDataSource(...) method which is returning all the rows in the list which is wrong. I need to get only those records which are updated by the user.
Thanks in Advance
Vijay
Hello Vijay,
If you are using cell editing feature then you can use the cell value change listener or row value chnage listener to get the index of operative row. You can get this information by using the event argument of the listener. Once you have index of the chanded row, you can fetch it from the underlying data model.
Hope it helps you.
Can i have the code please ...
My jsp code looks as below
<
"single"
/>
My java code is
public
System.
out.println("Row Event 0))))))))))))))))))))");
return "";
}
But the control is not coming into my java code..
Do I need to take care of anything else in jsp and java code for using value change listener...?
Hello,
I hope the problem you are facing due to the incorrect event handler signature in your application. You should use following signature:public void rowValueChange(RowValueChangeEvent rowEvent){// Your code goes here}Hope it helps you.
Roshan
Thanks for your reply Roshan
But I have already tested using the same..But my code flow is not hitting the java method...Along with the above code I am also sending my button code. I have two buttons which do two different functionality which actually modify the java list which populates the grid...so I want that changed value of the grid should actually get updated in my java list too in my backing bean.
Thanks Roshan I was able to capture the updated cell from the formula you provided.
Hello Monish..
Thats great..Follwing is the code snippets where object assiciated with the chnaged row has been fetched. Hope it gives you idea to proceed:public void rowValueChangeListener(RowValueChangeEvent evt){
System.out.println("In Row value Change Event"); // Find the Index of Row on Current Pageint temprowindex = evt.getRow(); // Actual Row Index in Model Collectionint rowindex = temprowindex + (grid.getPageSize()*grid.getPageIndex()); List rows= new ArrayList();// Rows Collection on Current Pagerows = grid.getRows();
// Rows that need to be updateRowItem row = (RowItem)rows.get(temprowindex); // Object associated with Changed RowEmployee emp = (Employee)grid.getDataRow(row); System.out.println("Changed Row =>" + emp.getFname() + " " + emp.getTotal());
I hope it clear you doubts...
Hi Roshan,
Thanks for your replies. I banged my head all yesterday and was not getting the output..but today morning i just ran my code and it worked absolutely fine. The control is goin to the java code. But I have one more question to ask regarding the capturing of the changed data in the backing bean. I am able to capture the changes of the cell in the java code but I want the complete row data to be obtained coz I need to querry to the database and insert the changes. Please help me in this? I am not able to fetch the complete row data but only the changed data.
The most important thing is that "Your RowValueChangeEvent is not triggering" and first thing you should try to find out what its root cause in your code.
You should follow the following step:In JSP:..<ig:gridEditing id="grd_edt1" enableOnMouseClick="single" rowValueChangeListener="#{webgrid_hierarchicalGridPage.rowValueChange}" updateMode="row" />In Java:public void rowValueChange(RowValueChangeEvent rowEvent){System.out.println("Event Triggered");}Also you need to know when the row value change should trigger. If you edit a cell and after editing you move to the next cell of the same row..and you suppose that the row value change should trigger then ofcourse it will not. The cell value change event will trigger as you edit the row and the focus get out from that row.
Hope it helps you. If you still face the issue, please provide your complete code (JSP , and backing bean) by which we could look into this.