Announcement

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

    Calling setHeaderSpans on undrawn ListGrid

    I'm using:

    SC_SNAPSHOT-2011-03-23/PowerEdition Deployment (built 2011-03-23)

    Although I have observed the same behaviour in the v8 Release build, too.

    Code:
    var a = ListGrid.create({autoDraw:false});
    a.setHeaderSpans([]);
    Throws the error Cannot call method 'duplicate' of undefined.

    But if you call setHeaderSpans after the component is drawn, no error is thrown.

    It doesn't seem to matter whether the ListGrid is databound or not; or whether you provide a populated array of valid headerSpans or an empty array.

    In my trying to isolate the cause, the key seems to whether the ListGrid isDrawn() at the time of calling setHeaderSpans.

    The following works without error (if executed step at a time at the command line):

    Code:
    var a = ListGrid.create({autoDraw:false});
    a.draw();
    a.setHeaderSpans([]);
    Many thanks

    #2
    Just set a.headerSpans during create or immediately afterwards. The set() call is for changing the value after the grid is drawn.

    Comment


      #3
      Thanks, David

      Comment

      Working...
      X