Friday, July 30, 2010

createRecordComponent is not called for the first record created

I'm using Smart GWT 2.2 and facing a strange bug. The com.smartgwt.client.widgets.grid.ListGrid#createRecordComponent(ListGridRecord record, Integer colNum) is not called for the very first record. Thanks to smartgwt's popularity, I found some complaints and workarounds.

In Issue 450 - smartgwt - createRecordComponent(final ListGridRecord record, Integer colNum) {} never executed, someone suggested create a function that does all the job createRecordComponent is supposed to do and call this function explicitly. If this works, the event model needs also to be hacked, because nothing wrong in createRecordComponent. Hope he/she will contribute the solution to the product.

In createRecordComponent not called for changed record when refreshing ListGrid, another one suggested showRecordComponent must be implemented as well, if not all the columns' component are created in create/updateRecordComponent. Sounds simple but no matter showRecordComponent returns true or false, createRecordComponent still fails to be called.

What helped me is ListGrid.createRecordComponent not called unless a column is sorted. I don't call setSortField because I have no field to sort. I call ListGrid#sort after a new record is added and problem solved.

No comments:

Post a Comment