morlandi / django-ajax-datatable

A Django app which provides the integration of a Django project with the jQuery Javascript library DataTables.net
MIT License
208 stars 64 forks source link

Border : 1px added in div in when 'searchable': False #9

Closed vdveldet closed 3 years ago

vdveldet commented 3 years ago

Hi,

I have a column_defs with first column a button to Edit. This column is not searchable or order-able. So on top there should not be such elements

However there is a styling added to the div that will reassemble like this s an searchable filed but in fact this is a border.

class CustomerAjaxDatatableView(AjaxDatatableView):

    model = Customer
    title = 'Customer'
    initial_order = [["name", "asc"], ]
    length_menu = [[10, 20, 50, 100, -1], [10, 20, 50, 100, 'all']]
    search_values_separator = '+'

    column_defs = [
        {'name': 'edit', 'title': '', 'searchable': False, 'orderable': False, },
        {'name': 'name', 'visible': True, },
        {'name': 'address1', 'visible': True, },
        {'name': 'address2', 'visible': True, },
        {'name': 'postciode', 'visible': True, },
        {'name': 'city', 'visible': True, },
        {'name': 'country', 'visible': True, },
    ]

Selection_094

morlandi commented 3 years ago

Thank you @vdveldet ... you're right. Since I normally use AjaxDatatableView.render_row_tools_column_def() as first column, I might have styled it to obtain this:

Screenshot 2021-02-05 at 09 04 10

My bad ! I'll fix this soon ;)

vdveldet commented 3 years ago

I just add some init now, that will help me.

      $(document).ready(function() {
        AjaxDatatableViewUtils.init({
            search_icon_html: '',
        });
    });

Thanks for the fine Django addition !

morlandi commented 3 years ago

Removed ;) Thank oy @vdveldet