Pegase745 / sqlalchemy-datatables

SQLAlchemy integration of jQuery DataTables >= 1.10.x (Pyramid and Flask examples)
MIT License
159 stars 67 forks source link

Implement Checkbox Functionality #106

Closed quiidado closed 5 years ago

quiidado commented 6 years ago

Unsure if this is user error or a potential issue with the code. I would like to utilize sqlalchemy-datatables to supply information to a datatable where column 0 is a multiselect checkbox. Similar to this functionality: https://jsfiddle.net/gyrocode/snqw56dw/

I am unsure what I would need to supply to the definition of "columns" in my python code. Is there something special I would need to define for ColumnDT that allows me to make the first column a checkbox?

Is this possible with this library? Would someone mind pointing me int he right direction?

tdamsma commented 6 years ago

I had a look and as far as I can tell the checkbox column is added in js. So no need to mess with the ColumnDT. You should just add the relevant js code to the template you use to generate the html.

quiidado commented 6 years ago

Ok - thank you for the look. I will keep digging to see if I can figure it out. When I add in the js code from that jsfiddle example it appears that my table is misaligned and column 0 gets stuffed with data instead of becoming a checkbox column. Is there something I need to define in my columns lists to let sqlalchemy-datatables know that column 0 is statically defined? This is what my columns variable is defined as:

columns = [
    ColumnDT(userDB.item),
    ColumnDT(userDB.item1),
    ColumnDT(userDB.item2),
    ColumnDT(userDB.item3),
    ColumnDT(userDB.item4),
    ColumnDT(userDB.item5),
]
tdamsma commented 5 years ago

Closed old issue