Extra function
Extra function
michelek
Posts: 24Questions: 5Answers: 0
Hello,
I'm working on this project http://accoglienza.eservers.it/join.html
How I can add two buttons to the edit interface? Button1 -> Completed and Button2 -> Not Completed
And I need this:
When I press on "Completed" button the correspondent record tr color become green and
when I press on "Not Completed" rebecome normal or transparent.
Any help?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi,
It sounds like you want to implement a custom button. You could simply have them call the
column().search()
method, followed bydraw()
to search and then draw the table.Edit - Sorry, I thought you wanted to filter the table using the buttons - it looks like you what to highlight certain rows.
rows().every()
would probably be the function to use in that case (to loop over all rows), along withrow().node()
to get the node so you can add / remove classes as needed.Regards,
Allan
Hmmm, I don't know exactly how to implement this function. Maybe I can explain better what I need.
I have a field named STATUS in the datatables, when I set STATUS to 1, default is 0 the entire row color must become GREEN, how I can do it?
I appreciate very much if you know help me
I might have misunderstood. You want the row to change colour based on the data that the rows contains? In which case
rowCallback
is probably the best way to do it. You would just add or remove a class from the row based on the data.Allan
Yeah! Can you give me an example of code, I don't know where and how to start?
There is an example in the
rowCallback
documentation which shows how you can manipulate the DOM based on the data in the row. In this case you just want to use the jQuery$().addClass()
and$().removeClass()
methods to add or remove the class.Allan
I will try
I have add this but I get undefined data so then I can't check if value is 1
http://accoglienza.eservers.it/join.html
I have found the solutions on google, from an old your answers
http://www.datatables.net/forums/discussion/6876/fnrowcallback-and-sajaxsource-giving-me-undefined-adata
Hi allan,
I have another problem on my project: http://accoglienza.eservers.it/join.html
Something wrong with mouse over color effect, it's not ok, how I can fix?
I need that when I move my mouse over the row it's changing back color to normal and when I click on it I need that entire row go to default blue color, but still remain green
You need to modify the CSS styling that you are using to make it more specific. If you right click in your browser and select "Inspect" element you will be able to see the styles that are being applied and what is overriding it.
Allan
My .addClass "test3" is overriding it! hmm
By the way i'm using the css you're using on your example
On your page I did the following:
You simply need to override that class with your own. Or remove that if you don't what the sorting column to have a highlight.
Allan