Announcement

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

    ListGrid::startEditingNew(record) is very slow

    Hello,

    I currently evaluating the 3.1d enterprise edition (2012/10/04). I've noticed that the method ListGrid::startEditingNew(record) is very slow. The creation of 100 new Records took 10,9 s in firefox and 5,7 s in chrome. I need to generate these entries on the fly so the user can complement some fields and save everytihng in one transaction.
    Is there a way to speed up this method? Here is a simple EntryPoint to test the behaviour:

    Code:
    	public void onModuleLoad() {
    		final ListGrid lg = new ListGrid();
    
    		lg.setFields(new ListGridField("f1"));
    		lg.setCanEdit(true);
    		lg.draw();
    
    		long time;
    		long timeTotal = System.currentTimeMillis();
    		for (int i = 0; i < 100; i++){
    			time = System.currentTimeMillis();
    			ListGridRecord record = new ListGridRecord();
    			record.setAttribute("f1", "foo");
    			lg.startEditingNew(record);
    			SC.logWarn("### " + i + ": " + (System.currentTimeMillis() - time));
    		}
    		SC.logWarn("### Total : " + (System.currentTimeMillis() - timeTotal));
    	}

    #2
    No need to use startEditingNew() - that actually shows an editor for each row.
    Better to simply use setEditValues() for each row you care about.

    Comment


      #3
      But with setEditvalues I can only set values for an existing Record. My aim is to create a new record with some default values. I also can't use ListGrid::addData(Record), because this will trigger immediately an add operation on the datasource.

      Comment


        #4
        Take a step back, the editValues system is designed to track user edits, and handles that approximate data volume. Users do not edit hundreds of records without saving (and/or the UI should not allow them to - too much potential data loss).

        So you should rethink your implementation approach so that you don't end up asking the editValues system to do something it wasn't designed to. Also please return to the previous thread we had with you where we explained alternatives to using new unsaved, records to to track changes.

        Comment

        Working...
        X