Announcement

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

    Timing problem with cacheAllData DS as optionDataSource for ListGridField

    We have a couple of data sources that use cacheAllData="true". Those are the optionDataSource for a couple of different ComboBoxes in a ListGrid and both exhibit the same behavior.

    When the ListGrid is first filled with data, including valid values for the valueField in each of the combo box fields, the displayField does not show the correct display value, it shows the valueField value as if it could not find that value in the optionDataSource valueMap.

    If we reload the grid with the same data the valueFields are correctly translated and the displayField value shows up in the ComboBox. It appears there is a timing problem where the valueMap doesn't get set up in time for the initial display.

    #2
    Another user recently identified a race condition with DataSources that specifically use autoCacheAllData:true (not just cacheAllData:true). Are yours like this?

    If not, then it's not clear what could cause this. Are you able to take any sample and just flip a DataSource used as an optionDataSource to cacheAllData:true and reproduce this effect? With some attempts we couldn't get it to happen.

    Comment


      #3
      This must not be related to cacheAllData="true" after all. I removed that from the ds.xml and the problem remains. Could the problem be caused by the fact that the grid is not visible when it is first filled with data? We're calling setData() with a RecordList to fill the grid, but the grid sits in a tab behind other tabs.

      When you first select the tab with the grid showing, the id/name translation has not been done and the field displays the id. Also, at that point, if you edit a grid row the comboboxitem switches to show the displayField. But when you click away from the record it goes back to showing the id field.

      There are other controls on the grid tab that allow the user to switch between different types of grids and when they do the current grid is destroyed and a different one is created. This happens while the grid is visible, and in this case each grid correctly shows the displayField.

      So it is only in the first instance when the grid is filled with data before it has been drawn that the id/name translation does not happen.

      Is there some method I can call on the grid that will force that value mapping to be redone? I've tried putting a tabSelectedHandler on the tab containing the grid and calling redraw() on the grid at that point, but that made no difference.

      Comment


        #4
        Is the effect that you have a displayField / optionDataSource specified on the ListGridField and the data (when not in edit mode) shows the data value rather than the display value? Or is it that the ComboBoxItem when in edit mode shows the data value rather than the display value?

        Can you show us the field definition from the .ds.xml file, as well as the ListGridField definition for the field on the grid (if there is one explicitly applied).

        You can probably force a recalculation via an explicit call to 'setFields' on the grid after draw - but this would be a hack - it would be better if we could get to the bottom of what's going on.

        As always if you could show us a test case that demonstrates this that would be ideal!

        Thanks
        Isomorphic Software

        Comment


          #5
          The problem was that the data (when not in edit mode) shows the data value rather than the display value. However, I just download the latest nightly 2011-04-19 and it is now working fine. When the list is first displayed the data values show up rather than the display value, but after a short delay (probably while the optionDataSource data is being loaded) the display values now show up.

          Comment


            #6
            That's good to hear. Since this problem has been somewhat intermittent for you, please do let us know if it resurfaces

            Comment


              #7
              I'm facing exactly same problem with SmartClient 8.2 LGPL. I recently downloaded newer SmartClient_SC_SNAPSHOT-2012-01-29 and it didn't help.

              Here is my code:
              Code:
              var opBindings = [
                  { operationType: 'fetch' , dataProtocol: 'postMessage' },
                  { operationType: 'add'   , dataProtocol: 'postMessage' },
                  { operationType: 'remove', dataProtocol: 'postMessage' },
                  { operationType: 'update', dataProtocol: 'postMessage' }
              ];
              
              isc.RestDataSource.create({
                  ID: 'przedmiotyDlaOcenDS',
                  dataURL: 'controller2.php',
                  dataFormat: 'json',
                  operationBindings : opBindings,
                  fields: [
                      { name: 'id', type: 'integer', primaryKey: true },
                      { name: 'nazwa', type: 'text' },
                      { name: 'edycja', type: 'boolean' }
                  ],
                  jsonPrefix: '[begin]',
                  jsonSuffix: '[end]',
                  requestProperties: { params: { idSzkoly: idSzkoly, rokSzkolny: rokSzkolny, idKlasy: idKlasy } },
                  cacheAllData: true
              });                                    
              
              isc.RestDataSource.create({
                  ID: 'ocenyDS',
                  dataURL: 'controller2.php',
                  dataFormat: 'json',
                  operationBindings : opBindings,
                  fields: dataFields,
                  jsonPrefix: '[begin]',
                  jsonSuffix: '[end]',
                  requestProperties: { params: { idSzkoly: idSzkoly, rokSzkolny: rokSzkolny, idKlasy: idKlasy } },
                  cacheAllData: true,
                  keepParentsOnFilter: true
              });
              The field with optionDataSource is:
              Code:
                  {
                      name: 'przedmiot', type: 'integer', title: 'Przedmiot', required: true, width: 160,
                      optionDataSource: 'przedmiotyDlaOcenDS', valueField: 'id', displayField: 'nazwa'
                  },
              TreeGrid is bound to ocenyDS. Field 'przedmiot' always displays id value instead of display value. However SelectItem editor opens with correct entry selected and value setting works fine too. After editor exits grid shows id value (instead of display value) again.

              Everything is set as documentation requires, but displayField doesn't show up.

              See additional screenshot: http://i.imgur.com/xPAEB.png (notice id is 147, but it maps correctly to display name *only* inside editor)

              EDIT: Previously I specified invalid nightly build version, correct is 2012-01-29
              Last edited by pszturmaj; 31 Jan 2012, 09:59.

              Comment


                #8
                It is a blocker for me so... *BUMP*

                optionDataSource does not work as expected (see above post)

                Comment


                  #9
                  This isn't a runnable test case, and does not suggest a framework bug - it suggests that your server is not correctly to the request initiated by the ListGrid when you set ListGridField.optionDataSource. Use the RPC tab to troubleshoot.

                  Comment


                    #10
                    Request to my server:
                    Code:
                    {
                       transaction:{
                          transactionNum:0,
                          operations:[
                             {
                                "dataSource":"przedmiotyDlaOcenDS",
                                "operationType":"fetch",
                                "data":null,
                                "oldValues":null
                             },
                             {
                                "dataSource":"ocenyDS",
                                "operationType":"fetch",
                                "data":null,
                                "oldValues":null
                             }
                          ]
                       }
                    }
                    Response from my server:
                    Code:
                    [begin]
                    [
                       {
                          "response":{
                             "status":0,
                             "data":[
                                {
                                   "id":146,
                                   "nazwa":"Biologia",
                                   "edycja":true
                                },
                                {
                                   "id":147,
                                   "nazwa":"Filozofia Kalego",
                                   "edycja":false
                                },
                                {
                                   "id":148,
                                   "nazwa":"Fizyka",
                                   "edycja":false
                                },
                                {
                                   "id":149,
                                   "nazwa":"J.Angielski",
                                   "edycja":false
                                }
                             ],
                             "queueStatus":0
                          }
                       },
                       {
                          "response":{
                             "status":0,
                             "data":[
                                {
                                   "id":"1",
                                   "parentId":"-20",
                                   "isFolder":false,
                                   "uczen":"Szturmaj Piotr",
                                   "przedmiot":147,
                                   "kategoria":-1,
                                   "semestr":"1",
                                   "data":"2008-11-24",
                                   "ocena":"5+",
                                   "do_poprawy":1,
                                   "komentarz":"comment"
                                },
                                {
                                   "id":"2",
                                   "parentId":"-20",
                                   "isFolder":false,
                                   "uczen":"Szturmaj Piotr",
                                   "przedmiot":147,
                                   "kategoria":-1,
                                   "semestr":"1",
                                   "data":"2008-11-24",
                                   "ocena":"5+",
                                   "do_poprawy":1,
                                   "komentarz":"comment"
                                },
                                {
                                   "id":"3",
                                   "parentId":"-20",
                                   "isFolder":false,
                                   "uczen":"Szturmaj Piotr",
                                   "przedmiot":147,
                                   "kategoria":-1,
                                   "semestr":"1",
                                   "data":"2008-11-24",
                                   "ocena":"5",
                                   "do_poprawy":1,
                                   "komentarz":"comment"
                                },
                                {
                                   "id":"4",
                                   "parentId":"-20",
                                   "isFolder":false,
                                   "uczen":"Szturmaj Piotr",
                                   "przedmiot":147,
                                   "kategoria":-1,
                                   "semestr":"1",
                                   "data":"2008-11-24",
                                   "ocena":"4",
                                   "do_poprawy":1,
                                   "komentarz":"comment"
                                },
                                {
                                   "id":"5",
                                   "parentId":"-20",
                                   "isFolder":false,
                                   "uczen":"Szturmaj Piotr",
                                   "przedmiot":147,
                                   "kategoria":-1,
                                   "semestr":"1",
                                   "data":"2008-11-24",
                                   "ocena":"4-",
                                   "do_poprawy":1,
                                   "komentarz":"comment"
                                },
                                {
                                   "id":"-20",
                                   "parentId":"0",
                                   "isFolder":true,
                                   "uczen":"Szturmaj Piotr",
                                   "przedmiot":0,
                                   "kategoria":-1,
                                   "semestr":null,
                                   "data":null,
                                   "ocena":"nb",
                                   "do_poprawy":0,
                                   "komentarz":null
                                },
                                {
                                   "id":"-21",
                                   "parentId":"0",
                                   "isFolder":true,
                                   "uczen":"Kowalski Pawe\u0142",
                                   "przedmiot":0,
                                   "kategoria":-1,
                                   "semestr":null,
                                   "data":null,
                                   "ocena":"nb",
                                   "do_poprawy":0,
                                   "komentarz":null
                                },
                                {
                                   "id":"-22",
                                   "parentId":"0",
                                   "isFolder":true,
                                   "uczen":"Nowak Jan",
                                   "przedmiot":0,
                                   "kategoria":-1,
                                   "semestr":null,
                                   "data":null,
                                   "ocena":"nb",
                                   "do_poprawy":0,
                                   "komentarz":null
                                }
                             ],
                             "queueStatus":0
                          }
                       }
                    ]
                    [end]
                    Dev console log (RPCManager and RPCManagerResponse set to DEBUG level):
                    Code:
                    22:38:19.489:INFO:Log:initialized
                    22:38:19.509:WARN:Log:NOTE: Firebug is enabled. Firebug greatly slows the performance of applications that make heavy use of JavaScript. Isomorphic highly recommends Firebug for troubleshooting, but Firebug and other development tools should be disabled when assessing the real-world performance of SmartClient applications.
                    22:38:19.937:WARN:Log:New Class ID: 'EditPane' collides with ID of existing Class object '[DataSource ID:EditPane]'.  Existing object will be replaced.
                    This conflict would be avoided by disabling ISC Simple Names mode.  See documentation for further information.
                    22:38:20.193:WARN:Log:ClassFactory.addGlobalID: ID:'toolbar' for object '[ToolStrip ID:toolbar]' collides with ID of existing object '[object BarProp]'. The global reference to this object will be replaced
                    22:38:20.198:WARN:ToolStrip:toolbar:Adding already drawn widget:addButton_label to new parent:toolbar. Child has been cleared so it can be drawn inside the new parent. This may be a result of autoDraw being enabled for the child.
                    22:38:20.198:WARN:ToolStrip:toolbar:Adding already drawn widget:addButton to new parent:toolbar. Child has been cleared so it can be drawn inside the new parent. This may be a result of autoDraw being enabled for the child.
                    22:38:20.199:WARN:ToolStrip:toolbar:Adding already drawn widget:delButton_label to new parent:toolbar. Child has been cleared so it can be drawn inside the new parent. This may be a result of autoDraw being enabled for the child.
                    22:38:20.199:WARN:ToolStrip:toolbar:Adding already drawn widget:delButton to new parent:toolbar. Child has been cleared so it can be drawn inside the new parent. This may be a result of autoDraw being enabled for the child.
                    22:38:20.505:INFO:RPCManager:sendQueue called with no current queue, ignoring
                    22:38:20.510:WARN:VLayout:vlayout:Adding already drawn widget:toolbar to new parent:vlayout. Child has been cleared so it can be drawn inside the new parent. This may be a result of autoDraw being enabled for the child.
                    22:38:20.517:WARN:VLayout:vlayout:Adding already drawn widget:grid to new parent:vlayout. Child has been cleared so it can be drawn inside the new parent. This may be a result of autoDraw being enabled for the child.
                    22:38:20.794:INFO:Log:isc.Page is loaded
                    22:38:20.796:INFO:RPCManager:Resubmitting transaction number: 0
                    22:38:20.802:WARN:RPCManager:Multiple RPCRequests with params attribute in one transaction - merging
                    22:38:20.803:INFO:RPCManager:sendQueue[0]: 2 RPCRequest(s); transport: xmlHttpRequest; target: controller2.php
                    22:38:20.803:DEBUG:RPCManager:XMLHttpRequest POST to controller2.php?idSzkoly=0&rokSzkolny=2011&idKlasy=55&isc_dataFormat=json contentType: application/json with body -->{ transaction: { transactionNum: 0, operations: [{
                        "dataSource":"przedmiotyDlaOcenDS", 
                        "operationType":"fetch", 
                        "data":null, 
                        "oldValues":null
                    }, {
                        "dataSource":"ocenyDS", 
                        "operationType":"fetch", 
                        "data":null, 
                        "oldValues":null
                    }]}}<--
                    22:38:21.031:XRP5:INFO:RPCManager:transaction 0 arrived after 226ms
                    22:38:21.032:XRP5:DEBUG:RPCManager:Result string for transaction 0: "[begin][{"response":{"status":0,"data":[{"id":146,"nazwa":"Biologia","edycja":true},{"id":147,"nazwa":"Filozofia Kalego","edycja":false},{"id":148,"nazwa":"Fizyka","edycja":false},{"id":149,"nazwa":"J.Angielski","edycja":false}],"queueStatus":0}},{"response":{"status":0,"data":[{"id":"1","parentId":"-20","isFolder":false,"uczen":"Szturmaj Piotr","przedmiot":147,"kategoria":-1,"semestr":"1","data":"2008-11-24","ocena":"5+","do_poprawy":1,"komentarz":"comment"},{"id":"2","parentId":"-20","isFolder":false,"uczen":"Szturmaj Piotr","przedmiot":147,"kategoria":-1,"semestr":"1","data":"2008-11-24","ocena":"5+","do_poprawy":1,"komentarz":"comment"},{"id":"3","parentId":"-20","isFolder":false,"uczen":"Szturmaj Piotr","przedmiot":147,"kategoria":-1,"semestr":"1","data":"2008-11-24","ocena":"5","do_poprawy":1,"komentarz":"comment"},{"id":"4","parentId":"-20","isFolder":false,"uczen":"Szturmaj Piotr","przedmiot":147,"kategoria":-1,"semestr":"1","data":"2008-11-24","ocena":"4","do_poprawy":1,"komentarz":"comment"},{"id":"5","parentId":"-20","isFolder":false,"uczen":"Szturmaj Piotr","przedmiot":147,"kategoria":-1,"semestr":"1","data":"2008-11-24","ocena":"4-","do_poprawy":1,"komentarz":"comment"},{"id":"-20","parentId":"0","isFolder":true,"uczen":"Szturmaj Piotr","przedmiot":0,"kategoria":-1,"semestr":null,"data":null,"ocena":"nb","do_poprawy":0,"komentarz":null},{"id":"-21","parentId":"0","isFolder":true,"uczen":"Kowalski Pawe\u0142","przedmiot":0,"kategoria":-1,"semestr":null,"data":null,"ocena":"nb","do_poprawy":0,"komentarz":null},{"id":"-22","parentId":"0","isFolder":true,"uczen":"Nowak Jan","przedmiot":0,"kategoria":-1,"semestr":null,"data":null,"ocena":"nb","do_poprawy":0,"komentarz":null}],"queueStatus":0}}][end]"
                    22:38:21.038:XRP5:INFO:RPCManager:rpcResponse(unstructured) results -->{response: Obj}<--
                    22:38:21.048:XRP5:DEBUG:RPCManager:Grabbed prompt from first request that defined one: Wyszukiwanie rekordów odpowiadających kryteriom...
                    22:38:21.050:XRP5:INFO:RPCManager:rpcResponse(unstructured) results -->{response: Obj}<--
                    22:38:21.062:XRP5:DEBUG:RPCManager:Grabbed prompt from first request that defined one: Wyszukiwanie rekordów odpowiadających kryteriom...
                    22:38:21.098:TMR8:DEBUG:RPCManager:Result string for transaction 1: undef
                    22:38:21.099:TMR8:INFO:RPCManager:rpcResponse(unstructured) results -->{status: 0}<--
                    22:38:21.103:TMR9:DEBUG:RPCManager:Result string for transaction 2: undef
                    22:38:21.105:TMR9:INFO:RPCManager:rpcResponse(unstructured) results -->{status: 0}<--
                    22:38:21.114:TMR0:DEBUG:RPCManager:Result string for transaction 3: undef
                    22:38:21.116:TMR0:INFO:RPCManager:rpcResponse(unstructured) results -->{status: 0}<--
                    22:38:21.118:TMR1:DEBUG:RPCManager:Result string for transaction 4: undef
                    22:38:21.121:TMR1:INFO:RPCManager:rpcResponse(unstructured) results -->{status: 0}<--
                    RPC tab: http://i.imgur.com/sUzpe.png

                    Do you see something wrong here? At least I don't. I don't know how to make runnable test case without a server.

                    Comment


                      #11
                      What you've shown looks correct. There was a fix in this area committed just days ago so please try with the latest. If you still have the problem, since there's just one request you can make a standalone test case by just saving the response as a file and pointing to it with dataURL.

                      Comment


                        #12
                        I tried both:
                        - SmartClient_SC_SNAPSHOT-2012-02-02_v82p
                        - SmartClient_SC_SNAPSHOT-2012-02-03_v83d.

                        They still produce this bug.

                        So, here's test case: http://dl.dropbox.com/u/59753506/testcase.zip. Tested on Firefox 10.0 on Windows XP SP3. I couldn't make it work on Chrome.

                        Main bug is displayField not working, but there's also another issue. If 'hidden:true' parameter of field 'uczen' is uncommented, then 'data' filter editor is also hidden, but it should not be.
                        Last edited by pszturmaj; 3 Feb 2012, 17:56.

                        Comment


                          #13
                          Fixed the displayField bug for next nightly build of 8.2p and 8.3d. Thanks for the test case, but please trim off unrelated logic next time, it was almost rejected for not being minimal.

                          Comment


                            #14
                            Originally posted by Isomorphic
                            Fixed the displayField bug for next nightly build of 8.2p and 8.3d. Thanks for the test case, but please trim off unrelated logic next time, it was almost rejected for not being minimal.
                            Thank you, I did cut most of the code and leaved the rest as is. I guess it wasn't enough. Well, sorry about that, I will trim all unnecessary things next time.

                            How about second issue with hiding filter editor? I mentioned it in previous post. There's also a comment in JS source. Should I post another (trimmed) test case?

                            Comment


                              #15
                              Note that the other problem (hiding one field makes next field not filterable) is because hiding that field makes the "data" field into the "treeField" (see TreeGrid docs on this) which is not filterable by default.

                              Comment

                              Working...
                              X