django-datatable-view icon indicating copy to clipboard operation
django-datatable-view copied to clipboard

"DataTables warning: table id=DataTables_Table_0 - Ajax error" with XEditableColumns

Open crisefd opened this issue 9 years ago • 3 comments

Following the example given at: http://django-datatable-view.appspot.com/x-editable-columns/

I created the view:

class UserDatatableView(XEditableDatatableView, LegacyDatatableMixin):
    model = User
    template_name = 'user_list.html'
    datatable_options = {
        'columns': [
            ("Nombres", 'first_name', helpers.make_xeditable),
            ("Apellidos", 'last_name', helpers.make_xeditable),
            ("Nombre de usuario", 'username', helpers.make_xeditable),
            ("e-mail", 'email', helpers.make_xeditable),
            ("Doc ID", 'id_document', helpers.make_xeditable),
            ("Nacimiento", 'birth_date', helpers.make_xeditable),
            ("Direccion", 'address', helpers.make_xeditable),
            ("Telefono", 'phone_number', helpers.make_xeditable)

        ]
    }

And the page javscript is:

<script type="text/javascript" src ="{% static 'js/datatableview.js'%}"></script>
  <script language='javascript'>
     //datatableview.auto_initialize = false;
    $(function(){
        var xeditable_options = {};
        datatableview.initialize($('.datatable'), {
        fnRowCallback: datatableview.make_xeditable(xeditable_options),

  });
  })
</script>

I used, LegacyDatatableMixin because XEditableDatatableView does not have the datatable_options attribute But, when loading the page it shows the above error.

crisefd avatar Dec 07 '15 20:12 crisefd

+1

y9c avatar Oct 14 '16 03:10 y9c

I think this will have to be revisited with the updated versions of the code. I'll leave the issue open but anything using the Legacy table mixins is highly suspect.

All of the 'modern' versions of the views are missing the datatable_options attribute because they want you to point it at a Datatable subclass, which looks a lot like a django ModelForm.

tiliv avatar Feb 28 '17 00:02 tiliv

beautiful goodbye

rico000041 avatar Sep 26 '17 09:09 rico000041