Datatable dynamic conditional format
Datatable dynamic conditional format
Hello all
I have a question.
A datatable (prog1) open another prog (onClick or other) that change some values in database.
After closing prog2 I'd like to reflect changes made by prog2 into datatable displayed by prog1 (as background color perhaps or else).
Is it possible ?
This discussion has been closed.
Replies
I have been to much long to edit this post.. sorry:
Hello all
I have 2 questions.
First one
Tbl2 has multiple rows connected with tbl1.ID
I need to know if in Tbl2 one (or more) row connected with Tbl1 has a particular property.
In SQL I'd write
and I 'd like to inst this bool value to editor (to format table at start for example)...
How to ?
Other question:
A datatable (prog1) open another prog (onClick or other) that change some values in database.
After closing prog2 I'd like to reflect changes made by prog2 into datatable displayed by prog1 (as background color perhaps or else).
In fact prog2 can add or edit a record that may change the $BoolRes of the first question...
Is it possible ?
You'd need to know what rows have been effected in
prog1
based on the changes. Possibly a SELECT for the row id's based on the joined ids fromprog2
? With that information you can then add a class to the rows / cells which have changed, but you'd need to know that information.Two options here:
Allan
Hello @allan
Thanks for your answer.
1- Yes I can know if I need to refresh display, but only using a form timer and then refresh the entire form. I don't know how to query again the database from JS...
As I said there is a month, I'd never use JS to work with databases so I'm an old newbie...
If I place a form timer starting a function each xxx seconds, how to scan again database without refreshing the whole page, just changing background color if needed ?
2- In SQL it's not really difficult, but... in JS actual getdata is a little bit complex
So i'm afraid of result adding an mjoin to the actual query
Do you think there is no risk ?
No way to set an instance as a function(Row.id) ?
If you've got DataTables setup to use
ajax
to read the data source, then useajax.reload()
to reload the data from the server.In what way? Do you mean performance or something else? Performance-wise it should be fine unless you have a really large data set. We use two queries to get the data and then combine it in PHP, rather than attempting to do one query per row to get the joined data.
Allan