Announcement

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

    Does a ComboBoxItem support "canDragResize" property on the PickListMenu autochild?

    1. SmartClient Version: v12.0p_2018-09-15/Pro Deployment (built 2018-09-15)
    2. Build identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0
    3. N/A
    4. N/A
    5. N/A
    6. Code follows

    User need:
    Resize a picklist both vertically and/or horizontally

    What I tried:
    I took the following code from the show case -> https://www.smartclient.com/smartcli...comboBoxStyled
    and added the property canDragResize : true to the pickListProperties.
    I expected the pick list to become resizable but the it does not work.

    Does a ComboBoxItem support "canDragResize" property on the PickList autochild?
    From the documentation, a ComboBoxItem will display a PickListMenu autochild which does have the "canDragResize" property

    Code:
    isc.DynamicForm.create({
        ID: "testForm",
        width: 500,
        items: [{
            name: "itemName", title: "Item Name", editorType: "ComboBoxItem", valueField: "itemID",
            addUnknownValues: false,
            optionDataSource: "supplyItem",
            width: 250,
            pickListCellHeight: 50,
            pickListProperties: {
                canHover: true,
    [B]canDragResize : true,[/B]
                showHover: true,
                cellHoverHTML : function (record) {
                    return record.description ? record.description : "[no description]";
                },
                formatCellValue : function (value, record, field, viewer) {
                   var descStr = record.description ? record.description : "[no descripton]";
                   var styleStr = "font-family:arial;font-size:11px;white-space:nowrap;overflow:hidden;";                                  
                   var retStr = "<table>" +
                   "<tr><td ><span style='" + styleStr + "width:170px;float:left'>" + record.itemName + "<span></td>" +
                   "<td align='right'><span style='" + styleStr + "width:50px;float:right;font-weight:bold'>" + record.unitCost + "<span></td></tr>" +
                   "<tr><td colSpan=2><span style='" + styleStr + "width:220px;float:left'>" + descStr + "</span></td></tr></table>";
                   return retStr;
                }
            }
        }]
    Last edited by Vivek_Gungabissoon; 18 Sep 2018, 10:24.

    #2
    This would not work because the ComboBox has internal logic to respond immediately to mouseDown, so the drag would never start.

    To do this properly you would need to add a resizer "grip" at the edge of the picklist, and you'd want to avoid it clipping part of the data, so you'd need something like a thick border around the picklist...

    However we would not recommend doing this. In the rare case that you see a resizable picklist, it usually means that the developer has simply not paid attention to proper default sizes, or is trying to cram too much information into a picklist when it should properly be presented in some other component. Adding a resizer is basically a hack that forces the end user to deal with a poorly designed drop-down.

    Comment


      #3
      ISSUE RESOLVED.

      NOTES:
      Code:
      canDragResize : true,
      border : '2px solid blue',
      redrawOnResize : true,
      I added the properties above to make the picklist resizable. The redrawOnResize : true, is also needed else the initial resize when pulling from the bottom does not render correctly.
      I will not be going for this solution as for the time being a default height does the job. Also, the bottom border is not "grippable" when the border is defined as being transparent
      i.e. border : '2px solid transparent' will not work.

      UX:
      A resizable picklist is a reasonable user expectation. More importantly, the framework i.e. SmartClient should be able to support the control without a pre-determined UX decision.

      Comment


        #4
        A strange comment. The framework does indeed support adding resizing, as we said, and as you just confirmed.

        Comment

        Working...
        X