Announcement

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

    ComboBox ListGrid filter Editor Problem

    We have a implementation where we use ListGrid filtereditor for search and drop down fields are comboBox so that the user can type as well as select a single value. Our users are using this field more frequently as text field but they still like the auto complete feature of comboBox. After upgrading to Smartclient 9, values on comboBox field are not retained after clicking on filter button, search works fine though but user gets lost as they can't see what they had searched for. I'll try to provide the working example but was just thinking if this is common or known issue and I can get a quick update.

    #2
    There's no such known issue, but what you describe sounds like what would happen if you set addUnknownValues:false on a ComboBoxItem. This setting didn't exist on ComboBoxItem in previous versions of SmartClient, but maybe somehow the setting is present in your code due to a copy and paste issue or the like.

    Comment


      #3
      We have not set this property. To give you some more background, this was happening when we set autoFitWidthApproach = "both" and autoFitFieldWidths to true and if were getting any results from server which would make listgrid width to change, value was getting disappeared but we changed autoFitFieldWidths to false for filter editor search purposes. Now issue is when user types something in comboBox and then search add another criteria from any other field (mostly other selectitem dropdowns) then value is getting disappear as well.

      Comment


        #4
        Then we will definitely need to see a runnable test case for this, as well as other required details (browser(s) affected, exact version, etc).

        Comment


          #5
          Would it be fine if I send you my listgrid definition and datasource?

          Comment


            #6
            Since that's presumably not going to be a ready-to-run test case - no. If we can't reproduce the issue we can't fix it for you.

            The usual approach is either:
            1. Tweak a sample to reflect your settings

            OR

            2. Simplify your application code and switch it to a clientOnly DataSource so it runs standalone

            Comment


              #7
              I am trying the first approach and changed the code of Live Grid example as below, can't figure out why Category Drop down is not showing any values:

              isc.ListGrid.create({
              ID:"dsListGrid",
              width: "100%",
              height: "100%",
              autoFitData: "horizontal",
              autoFetchData: true,
              dataSource: "supplyItem" ,
              alternateRecordStyles:true,
              dataPageSize: 50,
              autoSaveEdits :false,
              editEvent :"click",
              editByRow: true,
              canMultiSort :false,
              animateFolders: false,
              canReorderFields: true,
              headerHeight : 40,
              arrowKeyAction : "focus",
              selectionAppearance: "checkbox",
              canAddFormulaFields: true,// open for ER-2733
              canAddSummaryFields: true,
              showResizeBar : true,
              resizeBarTarget: "next",
              baseStyle:"cell",
              leaveScrollbarGap: true,

              autoFitWidthApproach :"both",
              showFilterEditor: true,
              bodyProperties :{
              canSelectText:true
              },
              headerClick : function (fieldNum){
              var field = this.getField(fieldNum);
              if(field.name != "mode"){
              return this.Super("headerClick", arguments);
              }
              },
              dataProperties: {
              fetchMode: "paged"
              },
              filterData : function (criteria, callback, requestProperties) {
              this.setAutoFitWidthApproach (null);
              this.setAutoFitFieldWidths (false);
              this.fetchData(criteria, callback, requestProperties);
              },
              fields : [
              {
              name : "category" ,
              optionDataSource : "supplyCategory",
              displayField :"categoryName",
              valueField :"parentID",
              filterEditorType: "comboBox"
              },
              {
              name : "itemID"
              },
              {
              name : "itemName"
              },
              {
              name : "SKU"
              },
              {
              name : "units"
              },
              {
              name : "unitCost"
              },
              {
              name : "inStock"
              }, {
              name : "nextShipment"
              }
              ]
              });

              Comment


                #8
                If your settings for optionDataSource, displayField and valueField are intended for the ComboBoxItem, they should be in an editorProperties block, not directly on the ListGrid field.

                What is this code trying to achieve?

                Code:
                filterData : function (criteria, callback, requestProperties) {
                   this.setAutoFitWidthApproach (null);
                   this.setAutoFitFieldWidths (false);
                   this.fetchData(criteria, callback, requestProperties);
                },
                This does not make a lot of sense..

                Comment


                  #9
                  As I said earlier, if we had something in resultset which would make listgrid columns change their width, values in comboBox item were getting disappeared, so while filter editor search, we disabled autoFit. Also, valueField and displayField works fine in our application even if we define directly under the field but I'm trying editorProperties to get this example to work so that I can try to reproduce the issue.
                  Last edited by spant; 23 Jan 2014, 12:10.

                  Comment


                    #10
                    I changed the field definition as suggested but drop down is still not showing any values.

                    {
                    name : "category" ,
                    optionDataSource : "supplyCategory",

                    filterEditorType: "comboBox",
                    editorProperties :{
                    displayField :"categoryName",
                    valueField :"parentID"
                    }
                    },

                    Comment


                      #11
                      if we had something in resultset which would make listgrid columns change their width, values in comboBox item were getting disappeared, so while filter editor search, we disabled autoFit.
                      Your code wouldn't achieve this. filterData() is not called by the FilterEditor. There's a ListGrid.filterEditorSubmit API you could use to get notified of when the filterEditor performs filtering.

                      However, bigger picture, if what you're trying to demonstrate is a framework bug where autofit causes values to be dropped, you should remove your attempted workaround, right?

                      About placement of properties: as we said, optionDataSource, valueField and displayField are all properties seemingly intended for the comboBox. Please see the docs for ListGridField - these properties do apply to ListGridField as well, but the behavior is different.

                      However your settings for valueField/displayField are also wrong. valueField should be a field with unique values, but parentID is obviously not a field with unique values in the supplyCategory DataSource. In fact there is no pair of valueField and displayField that makes sense for use with this DataSource. Instead, you could use supplyItem with valueField:"itemID" and displayField:"itemName" - this is shown in many samples.

                      Also, filterEditorType should be "ComboBoxItem", not just "comboBox".

                      Comment


                        #12
                        I've just tested that code is going in filterData when we click on filter button on listgrid filterEditor. Our application code was originally written in 2009 and we used smartclient 7, although I am still trying to reproduce the behavior in example code.

                        The issue is that if we search for more than one field then values in combo box field disappears, width functions called in filterdata fixed the issue where values were disappearing with change of width.

                        Comment


                          #13
                          Originally posted by spant View Post
                          I've just tested that code is going in filterData when we click on filter button on listgrid filterEditor.
                          This is not a documented or guaranteed behavior, it's mode-specific and can change at any time. That's why the filterEditorSubmit API is there.

                          But again, there is no reason this code would be in your test case, since it is meant to *work around* the very problem you are trying to demonstrate.

                          The issue is that if we search for more than one field then values in combo box field disappears, width functions called in filterdata fixed the issue where values were disappearing with change of width.
                          If this can be reproduced, we can fix it.

                          Comment

                          Working...
                          X