Note that there are some explanatory texts on larger screens.

plurals
  1. POSmartGWT - Update ListGridRecord dynamically
    text
    copied!<p>I am using SmartGWT and I have a ListGrid populated with an array of ListGridRecords using the setData() call. I am trying to update a progress property of a single record (on a timer for testing) and have it update in the browser. I have tried various combinations of draw(), redraw(), markForRedraw() etc. to no avail. </p> <p>I also tried overriding the updateRecordComponent() method in my table class, but it only gets called when the records are first created (after createRecordComponent()).</p> <p>I should note that I do NOT want to accomplish this by binding to a DataSource. I just want to be able to update the attribute on the client-side.</p> <pre><code>ArrayList&lt;SegmentSortRecord&gt; mRecords; mRecords.add(new SegmentSortRecord("03312010_M001_S004")); mRecords.add(new SegmentSortRecord("03312010_M001_S005")); mRecords.add(new SegmentSortRecord("03312010_M001_S006")); mRecords.add(new SegmentSortRecord("03312010_M001_S007")); SegmentSortRecord[] records = new SegmentSortRecord[mRecords.size()]; mRecords.toArray(records); mSortProgressTable.setData(records); </code></pre> <p>. . .</p> <pre><code>mTestTimer = new Timer() { public void run() { mTestPercent += 5; if (mTestPercent &lt;= 100) { mSortProgressTable.getRecord(2).setAttribute(Constants.PROGRESS_COL_NAME, mTestPercent); //mSortProgressTable.markForRedraw(); //mSortProgressTable.redraw(); } else { mTestPercent = 0; } } }; </code></pre> <p>...</p> <pre><code>@Override protected Canvas createRecordComponent(final ListGridRecord aRecord, Integer aColumn) { String fieldName = getFieldName(aColumn); // Want to override the behavior for rendering the "progress" field if (fieldName.equals(Constants.PROGRESS_COL_NAME)) { Progressbar bar = new Progressbar(); bar.setBreadth(10); bar.setLength(100); // The JavaScript record object contains attributes that we can // access via 'getAttribute' functions. bar.setPercentDone(aRecord.getAttributeAsInt(Constants.PROGRESS_COL_NAME)); return bar; } </code></pre> <p>Thanks in advance for any help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload