shymonk/django-datatable

Can't use LinkColumn with ajax = true

lbxxdi opened this issue · 2 comments

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

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'))])

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)