Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid record move up/down problem

    Version: smartgwt-power-5.0-p20150731
    On version 4.1, we had ListGrid subclass with move up/down buttons (created by overriding createRecordComponent) to allow users to reorder rows.

    Our code was for move up was:
    Code:
    	private void moveUp(ListGridRecord record) {
    		RecordList rs = getRecordList();
    		int index = getRecordIndex(record);
    
    		if (index > 0) {
    			rs.removeAt(index);
    			rs.addAt(record, index - 1);
    		}
    	}
    With 5.0-p20150731, this code starts a indefinite 100% cpu use with the calls:
    isc_c_Timer__fireTimeout
    isc_c_Class_fireCallback
    isc_c_Canvas_clearRedrawQueue
    isc_c_Canvas_clearDestroyQueue

    We managed to work that around at the cost of some flicker effect, with:
    Code:
    	private void moveUp(final ListGridRecord record) {
    		final RecordList rs = getRecordList();
    		final int index = getRecordIndex(record);
    
    		if (index > 0) {
    			rs.removeAt(index);
    			Scheduler.get().scheduleDeferred(new Command() {
    				@Override
    				public void execute() {
    					rs.addAt(record, index - 1);
    				}
    			});
    		}
    	}
    We'd like to use our previous code to avoid the flicker. Is there anything wrong with it that could cause the issue?

    #2
    How is moveUp() called? Most likely, you have placed the code somewhere that it will be called when the grid redraws, so that would create a loop.

    Comment


      #3
      It is called at the click handler of an ImgButton on an embedded component cell of that row (createRecordComponent).

      moveUp() is being called only once. The problem might be that the button in the record component is "moving" itself with the row.

      Comment


        #4
        That doesn't give us enough information to isolate the problem..

        Creating a minimal test case that replicates the problem always works. Short of that, you could try capturing the logs after enabling the "redraws" log category (this may show why the grid is redrawing continuously). You could also enable "redrawTrace" at DEBUG level to get stack traces

        Comment

        Working...
        X