HT for Web AccordionView Component Manual

Index


Overview

The HT for Web provides a accordion component class ht.widget.AccordionView for multiple-component folding and expansion effect, providing both horizontal and vertical layouts, and the accordion component that are absolutely positioned by setting the position to absolute.

AccordionView Component

Accordion component class ht.widget.AccordionView main configurable properties and functions are as follows:

Use the shorthand of horizontal h set to the horizontal layout

leftAccordion.setOrientation('h');

Overloaded the getLabelFont function and getCurrentTitle() determines the display font

leftAccordion.getLabelFont = function(title){
    return title === this.getCurrentTitle() ? 'bold 15px arial, sans-serif' : '13px arial, sans-serif';
};

Using setCollapseIcon and setExpandIcon to set two vector-format merge and expand icons respectively

leftAccordion.setCollapseIcon({
    width: 14,
    height: 14,
    comps: [
        {
          type: 'shape',
          points: [0, 7, 14, 7, 7, 0, 7, 14],
          segments: [1, 2, 1, 2],
          borderWidth: 1,   
          borderColor: '#303030'
        }
    ]
});
leftAccordion.setExpandIcon({
    width: 16,
    height: 16,
    comps: [
        {
          type: 'shape',
          points: [0, 8, 16, 8],
          segments: [1, 2],
          borderWidth: 1,   
          borderColor: '#303030'
        }
    ]
});

Built the div component, set its position to absolute, and set the vector title icon

function addView(accordionView, shape, color, expand){
    var div = document.createElement('div');  
    div.style.position = 'absolute';                
    div.style.background = color;

    accordionView.add(shape, div, expand, {
        width: 16,
        height: 16,
        comps: [
            {
              type: shape,
              rect: [0, 0, 16, 16],
              background: color,    
              gradient: gradient
            }
        ]
    });
}

Welcome to contact us service@hightopo.com