Hide cell in list view depend on condition

Hi
How I can hide Cell not whole column in list view, for example I need to hide any grand_total under 5000

Hi @Omar_Mohammed,

Here I applied for below 1000, so please check it.

frappe.listview_settings['Sales Order'] = {
    refresh: function(listview) {
        $('span.ellipsis[title^="Grand Total:"]').each(function() {
            var grandTotalText = $(this).attr('title').replace('Grand Total: ', '');
            var grandTotal = parseFloat(grandTotalText.replace(/[^0-9.-]+/g, ''));
            if (grandTotal < 1000) {
                $(this).find('div').text('');
            }
        });
    }
};

Output:

You can set your according.

Hope this helps :wink:

2 Likes

Bro, Your code is magic :upside_down_face:

It’s working as I want,

How I can refresh the list view every minutes

Apply it.

frappe.listview_settings['Sales Order'] = {
    refresh: function(listview) {
        function refreshListView() {
            listview.refresh();
        }
        setInterval(refreshListView, 60000);

        $('span.ellipsis[title^="Grand Total:"]').each(function() {
            var grandTotalText = $(this).attr('title').replace('Grand Total: ', '');
            var grandTotal = parseFloat(grandTotalText.replace(/[^0-9.-]+/g, ''));
            if (grandTotal < 1000) {
                $(this).find('div').text('');
            }
        });
    }
};
1 Like