Search code examples
phonejs

How to call the repaint() method?


Need a code example of repaint() method for dxList widget in Phonejs

NB: I want to call repaint() after a user action such as click.


Solution

  • Use the "repaint" method in the following manner:

    <!--TRIGGER-->
    <div data-bind="dxButton: { text: 'repaint dxList', clickAction: onClick }"></div>
    
    <!--TARGET LIST-->
    <div id="targetList" data-bind="dxList: { width: 100, dataSource: [{ key: 1, title: 'element_1'}, { key: 2, title: 'element_2' }, { key: 3, title: 'element_3' }] }">
        <div data-bind="dxAction: '#itemDetailsViewName/{key}'" data-options="dxTemplate : { name: 'item' } ">
            <div data-bind="text: title"></div>
        </div>
    </div>
    
    onClick: function () {
           var list = $("#targetList").dxList("instance");
           list.option('width', 200);            
           list.repaint();
    }