Announcement

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

    Bug in SmartGWT-EE sample “Large Value Map”

    Hi all,

    I’d like to report a bug in the SmartGWT-EE “Large Value Map” sample (a sub sample of the SQL branch in showcase)

    To replicate the problem:
    1. Go to the showcase in SmartGWT-EE (the public one or your own compiled give the same problem) URL is http://www.smartclient.com/smartgwtee/showcase/#large_valuemap_sql
    2. In the combobox for “Item Name” in the grid that appears, set the first few rows of order items to the same entry (For example, set the first five entries of the table to select the same “Footswitch for Desk Top Sanyo Machines FS55” in the combo box.
    3. When selecting from the combox for other rows, the expected behavior would be to have the “Footswitch for Desk Top Sanyo Machines FS55” appear only once. Instead it will appear five times.
    4. Closing the showcase and launching the same sample will display exactly the same problem.

    In other words, the Item Name combo box is populated from whatever is shown in the list grid, *not* from the content of the order item database table as one would expect. (This is what this particular sample is trying to show)

    This is directly relevant to what I need to do: namely have a combo box in a grid represent the records of another table.

    Could someone point me in the right direction to get this sample working as it should? (Or… is there another sample that has combobox working correctly with serverType=”sql” that I can work on?)

    Many thanks!

    Jean-Pierre

    #2
    The sample is working as designed and the records in the ComboBox reflect 5 distinct database records. There are 5 items with that itemName and distinct itemIds because people have been experimenting with the sample datasets.

    Comment


      #3
      Hi Administrator, thanks for that response.

      I am a bit surprised as this is not the typical behavior people expect in a combobox looking up another table. Is there another sample with serverType="sql" that demonstrates the behavior commonly found in database clients?

      Many thanks!

      Jean-Pierre

      Comment


        #4
        This is the behavior commonly found in database clients. It's a data problem. You would not have 5 identically named items with real data.

        Comment


          #5
          Hi Admin,

          I just verified by running the query below directly on the database used by showcase and only one record is returned.

          select * from supplyItem where (ITEMNAME = 'Footswitch for Desk Top Sanyo Machines FS55')

          I really think the sample is not running as it should.

          Jean-Pierre

          Comment


            #6
            Oh that's your confusion. The ComboBoxItem is not on the supplyItem DataSource, it's on the largeValueMap_orderItem DataSource shown in the sample.

            The purpose of the ComboBoxItem in this sample is to demonstrate that search works on a field that was joined from another DataSource.

            If you were creating this UI for searching orders, it's true that you might either use supplyItem as the optionDataSource for that field, or in some other way arrange things differently.

            Comment


              #7
              Hi Admin,

              I assumed it's looking from the table supplyItem because of its join in operationBindings...

              <operationBindings>
              <operationBinding operationType="fetch">
              <tableClause>valMapOrderItem, supplyItem</tableClause>
              <whereClause>valMapOrderItem.itemID = supplyItem.itemID AND ($defaultWhereClause)</whereClause>
              </operationBinding>
              </operationBindings>

              As well as its reference to tableName="supplyItem" in *.ds.xml
              <field name="itemID" type="integer" />
              <field name="itemName" type="text" tableName="supplyItem" />

              Because of the above, should the combobox not list the unique records in supplyItem?

              If I wanted to modify this sample to have the combobox list all the records in supplyItem, how would I do it?

              Thanks again for taking the time.

              Jean-Pierre

              Comment


                #8
                You just call setOptionDataSource on the ComboBoxItem.

                Comment


                  #9
                  Ah... excellent... It works!

                  For those following this thread, the following modification to the Large Value Map sample would have the combo box displaying unique entires in supplyItem as opposed to its own recordset.

                  <field name="itemID" type="integer" displayField="itemName" optionDataSource="supplyItem"/>
                  <field name="itemName" type="text" hidden="true" tableName="supplyItem"/>

                  (Note this is a design change that might compares apples to oranges, but at least this gives the interactivity you'd expect from a combobox in a database grid.)

                  To locate better working examples, just search for 'optionDataSource' in the SmartGWT-EE showcase.

                  Jean-Pierre

                  Comment

                  Working...
                  X