Announcement

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

    Bug in ListGrid.setFieldState() when showing a FilterEditor

    Hello everyone :)

    I came accross what seems to be a bug while working with SmartGwt, but it seems it is a SmartClient issue since I was able to reproduce it in SmartClient. I thus posted in this section.


    My goal
    I want the user to be able to customize his ListGrids as he wishes, and to save his choice. To do that, I use the getFieldState() / setFieldState().

    The problem
    Some of my ListGrids show a FilterEditor. The catch is, not all fields should be filterable. Half of them have canFilter : false. The bug appears when the user hides all the filterable columns, keeping only one (or many) field(s) where canFilter is set to false. If such a fieldState is persisted, I get an exception when I call the setFieldState():
    (The exception occurs at line 213 in RecordEditor.js, in the setFields() method)
    Code:
    if (this.isDrawn() && !this._editorShowing) this._startEditing(0, firstEditCell[1]);
    Firebug tells me that firstEditCell is null.



    Steps to reproduce:
    (some steps are obvious, but I'll just write everything I did anyway)
    • Download and extract SmartClient_70RC_LGPL.zip
    • Launch the embedded tomcat:
      Code:
      tylergalt@tylergalt:~/dev/resources/libs/smartclient/SmartClient_70RC/smartclientSDK$ ./start_embedded_server.sh
    • Navigate to the Feature Explorer's filter showcase:
      http://localhost:8080/isomorphic/sys...er.html#filter
    • In the JS tab, add canFilter:false to the "countryName" and "capital" fields:
      Code:
      isc.ListGrid.create({
          ID: "countryList",
          width:500, height:300, alternateRecordStyles:true,
          dataSource: worldDS,
          fields:[
              {name:"countryCode", title:"Code", width:50},
              {name:"countryName", title:"Country"[b], canFilter: false[/b]},
              {name:"capital", title:"Capital"[b], canFilter: false[/b]},
              {name:"continent", title:"Continent"}
          ],
          autoFetchData: true,
          showFilterEditor: true
      })
    • Click Try it. The showcase sample is updated: only "countryCode" and "continent" fields are now available for FilterEditor filtering.
    • Launch the SmartClient developer console (by typing javascript:isc.Log.show() in the URL location bar).
    • This part should work
      Use the "Evaluate JS Expression" to call setFieldState() on the ListGrid with a fieldState JSON object where at least one filterable field is visible (here, the "countryCode" field is visible and filterable):
      Code:
      var fieldState = eval([
          {
              name:"countryCode", 
              width:50
          }, 
          {
              name:"countryName", 
              visible:false
          }, 
          {
              name:"capital", 
              visible:false
          }, 
          {
              name:"continent", 
              visible:false
          }
      ]);
      countryList.setFieldState(fieldState);
    • This part does not work
      Now, repeat as above but with a JSON object that does NOT have any visible filterable field (here, the "countryName" and "capital" fields are the only visible fields, and they are not filterable):
      Code:
      var fieldState = eval([
          {
              name:"countryCode", 
              visible:false
          }, 
          {
              name:"countryName"
          }, 
          {
              name:"capital"
          }, 
          {
              name:"continent", 
              visible:false
          }
      ]);
      countryList.setFieldState(fieldState);
    • You get the exception mentioned above (but the code is obfuscated - don't know how to use the debug scripts in Feature Explorer).


    Since I am using linux, I was not able to provide an Internet Explorer stack trace. I could install IE in a VM if it turns out to be necessary.

    If you need any additional information, I'll be glad to provide it.


    Regards,

    -TylerGalt

    #2
    Hi Tyler
    Thanks for the clear steps to reproduce.
    We've found and fixed the error. The fix will be in 7.0 final.

    Regards
    Isomorphic Software

    Comment


      #3
      Originally posted by Isomorphic
      Hi Tyler
      Thanks for the clear steps to reproduce.
      We've found and fixed the error. The fix will be in 7.0 final.

      Regards
      Isomorphic Software
      This is great news!

      I'm glad I could contribute to improving SmartGwt, it is a great library, and a pleasure to use.

      Thanks a lot for fixing this so fast.

      Regards,

      -TylerGalt

      Comment


        #4
        The fix is in the SmartGWT SVN.

        Comment

        Working...
        X