jQuery UI Widgets Forums TreeGrid JqxTreeGrid update icon using updateRow

This topic contains 2 replies, has 2 voices, and was last updated by  Hristo 1 month, 3 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • JqxTreeGrid update icon using updateRow #114144

    ae50042
    Participant

    Hi all,

    I have a treegrid in virtualmode and everything work perfectly. Now I need every 10 seconds, update the icons of the treegrid based on the status received from the server.

    I’m trying to do that, using the method updateRow, but nothing happen is the treegrid. The method seems to work, because when I change another field (for example a label), the modification is done immediately.

    Strange thing: if after I have invoked the updateRow, I get the row, the icon path is updated, so the method has been update the row as expected, but the icon remain the same.

    I’m doing something wrong? I see for the jqxtree there is a similar issue:
    https://www.jqwidgets.com/community/topic/replacing-the-icon-of-an-item/ and
    https://www.jqwidgets.com/community/topic/update-tree-icon-dynamically/

    Maybe is there any workaround?

    Regards,
    Giorgio


    ae50042
    Participant

    Hi,
    I solved using a different strategy: I added another column called ‘icon’ as first (before I had just ‘label’ column and I used the settings icons:true in the jqxTreeGrid creation):

    var iconsrenderer = function (rowKey, dataField, value, data) {
        if(data.level == 2)
        return '<img style="margin-left:-20px" width="14" height="14" src="' + data.icon + '"/>';
        else
        return '';
    }
    
    var columns_list = [
           { text: '', dataField: 'icon', width:'70', cellsrenderer: iconsrenderer },
           { text: labels["DSP_COL_NOME"], dataField: 'label', width:'auto'}
        ];
    jQuery("#jqxTreeGrid").jqxTreeGrid({
            width: '100%',
            height:'500px',
            columns: columns_list,
            altRows: true,
            autoRowHeight: false,
            source : source,
            showHeader: false,
            editable: true,
            selectionMode: 'singlerow',
            icons: function (rowKey, rowData) {
                if (rowData.level == 0 || rowData.level == 1) {
                  return rowData.icon;
                }
              }
    });

    The problems maybe rely on the fact the with just the ‘label’ column, and using icons setting, the icon didn’t really exist, so nothing was produced as output.

    So, now that the ‘icon’ really exist as column, if I invoke the method setCellValue, it update it correctly.

    Regards,
    Giorgio

    JqxTreeGrid update icon using updateRow #114179

    Hristo
    Participant

    Hello Giorgio,

    Thank you for your contribution.
    This could help someone else.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.