shymonk / django-datatable

django-datatable is a customizable table application of django based on jquery datatable.
https://github.com/shymonk/django-datatable
MIT License
169 stars 55 forks source link

Can't use LinkColumn with ajax = true #16

Open lbxxdi opened 9 years ago

lbxxdi commented 9 years ago

with ajax = true

i use this code code = LinkColumn(header=u'Code', links=[Link(viewname='het', args=(A('code'),) , text=A('code'))])

it can pagination and link correctly and show complete list but when search it show errror "Ajax error. For more information about this error, please see http://datatables.net/tn/7"

but i change it to code = Column(field='code',header=u"Code") it's fully function ( can search with ajax = true )

how can i use ajax=true with link collumn

Thanks

arambadk commented 8 years ago

I had the same problem, I added field= to the LinkColumn definition. I used the variable used for text so in the above example I would change code = LinkColumn(header=u'Code', links=[Link(viewname='het', args=(A('code'),) , text=A('code'))]) to code = LinkColumn(header=u'Code',fields='code',links=[Link(viewname='het', args=(A('code'),) , text=A('code'))])

AlejandroMendez commented 6 years ago

Just add to code properties 'searchable=False', like this:

actions = LinkColumn(header=u'Actions', field='actions', links=[
        CustomLink(text='̣̣<i class="glyphicon glyphicon-eye-open"></i>', viewname='actUser', args=(A('id'),)),
        CustomLink(text='<i class="glyphicon glyphicon-pencil"></i>', viewname='change_users', args=(A('id'),)),  
        CustomLink(text='<i class="glyphicon glyphicon-trash"></i>', viewname='descUser', args=(A('id'),)),
    ], searchable=False)