Announcement

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

    Js error with datasource set in a SelectItem

    Hello,

    this post will be a possible bug report for "ComboxboxItem" and "SelectItem" when they are used with a Datasource set by method "setOptionDataSource".

    Version
    - Smartgwt: 2.5 (also with 2.3, 2.4)
    - SmartClient Version: SC_SNAPSHOT-2011-09-06/LGPL
    - Browser: IE 8/9, FF7+, Chrome16 (I used chrome with it's dev tools for debugging)


    I fixed the javascript error occured by modified the file "/com/smartclient/public/sc/modules/ISC_Forms.js" at line 2075 (see below), but this solution remove a part of process, it could cause possible side effects at others time.

    Code:
    if(_4){isc.PickListMenu.$512-=1;var _9=_4.$51v;
    var _6=_2[_9.getDataSource().getID()];
    if (_6!=undefined) _6.remove(_4);
    instead of

    Code:
    if(_4){isc.PickListMenu.$512-=1;var _9=_4.$51v;
    var _6=_2[_9.getDataSource().getID()];
     _6.remove(_4);

    the javascript error :

    Code:
    2012-02-06 19:25:24,188 [FATAL] Uncaught JavaScript exception 
    [Uncaught TypeError: Cannot call method 'remove' of undefined] in 
    http://localhost:5900/Gali/gali/sc/modules/ISC_Forms.js, line 2075
    Smartclient Developer Console :
    Code:
    18:03:03.567:TMR6:WARN:Log:TypeError: Cannot call method 'remove' of undefined
        unnamed() @ 
        storeSharedPickList() @ gali/sc/modules/ISC_Forms.js:2075:89
        <anonymous>() @ gali/sc/modules/ISC_Forms.js:2068:387
        SelectItem.makePickList() @ gali/sc/modules/ISC_Forms.js:2177:59
        fetchData() @ gali/sc/modules/ISC_Forms.js:2065:71
        SelectItem.drawn() @ gali/sc/modules/ISC_Forms.js:2138:151
        DynamicForm._itemsDrawn() @ gali/sc/modules/ISC_Forms.js:438:129
        DynamicForm.draw() @ gali/sc/modules/ISC_Forms.js:427:181
        Layout.layoutChildren() @ gali/sc/modules/ISC_Foundation.js:439:179
        Layout.drawChildren() @ gali/sc/modules/ISC_Foundation.js:341:100
        Canvas.draw() @ gali/sc/modules/ISC_Core.js:2052:247

    Now the context and how this error happened, if that could help you any logic in this error.
    I wrote an heavy application who used POJO with lazy-loading on the client side (server side made with spring2.5/hibernate...).
    The client side is build with a tabset, the error is throw after 8 opening and closing of a tab with hudge contents inside, this tab contains a stacksection (6 sections in) and each sections is different (have combobox, selectItems, treegrids, uploading form...).
    Ok well the error now, during the 9 opening of this screen just the tab is drawn, not the panel add to the tab. The canvas is created (I test with the method "canvas.isCreated()") but it can't drawn (the method canvas.isDrawn() put in a timer with repeating set to 500ms never return true).
    I checked the DOM with chrome dev tools and all elements are here with a "top:-9999px" set until the Vlayout containing the "SelectItem" and his associated "DataSource"; this layout and after aren't in the DOM.

    So I changed the javascript like I sayed before but I'm not sure that's the right answer. The involved component still be the "DataSource" of a "SelectItem", I say "the DataSource" because I tested without "DataSource" there's no errors and also just without not loading data in DataSource and the error happened.

    Just one more thing (no it's not the Iphone 5), the main cause seems to be a memory problem because when I remove this section the error also occured (on another section with selectItem inside), but later (can do 16 open/close of this tab), the time of loading tab also increased after each drawn. I take a snapshot of browser memory with chrome tools, and I saw the datasource who generated the error aren't destroyed on tab close. There is 9 DS in memory corresponding to the selectItem one different for each opening, others DS related to treegrid or others components are correctly destroyed.
    I'll try to destroy manually this datasource on close but not worked.


    I know that's a strange bug, and a possible result of how my application was wrote but if you have any ideas, I'll take it. You could join me by email for more informations, I done many tests before changed the js.


    Thanks.
    Last edited by kanon; 7 Feb 2012, 10:15.

    #2
    Please try this will the fully patched 2.5 or 3.0 version (see smartclient.com/builds). If it isn't already fixed, we'd need a ready to run, minimal test case to look into it.

    Comment


      #3
      I'll try with the lasted patched build for 2.5 version, it's not better. I'll give you a test case when I found how reproduce it by a simple way.

      Comment


        #4
        Hello. Have you found a better solution than editing ISCForms? We have a similar issue with SelectItem. It is unfortunately difficult to reproduce so I haven't been able to create a standalone test case yet but our logs show
        Code:
        (TypeError): Cannot call method 'remove' of undefined
        at Unknown.mc(StackTraceCreator.java:168)
        at Unknown.gb(StackTraceCreator.java:421)
        at Unknown.K2(Exceptions.java:29)
        at Unknown.qMb(SelectItem.java:1431)
        ...
        when performing fetchData on SelectItem. We are using smartgwt 3.0p.

        Comment


          #5
          No, still working with the describe hack.
          I'll try to provide a test case with the same application but not link to our database but no error happened definiteky due to the poor charge of datas.
          I continue to think it's a memory issue with datasource set on selectItem or comboBox.

          Comment

          Working...
          X