Update row from another page
Update row from another page
Hi all
In page_1 I select a datatable row, then click a button that open page_2 that display a document and allow user to click on "export to pdf".
If user do export, I need to set a export date (il not already set) so I set (if exported to pdf) this value in sql table (using direct sql).
Page 2 may stay open or close, but
When I go to page_1, the selected row is not refreshed and the new value is set in the database (I can see it) but not displayed in datatable (not reloaded).
Is there a way to refresh table in page_1 calling something in page_2 ?
I know, christmas is december 24 this year...
Thanks
Replies
ajax.reload()
is the way to refresh a Datatable from the database, assuming you are using theajax
option.Are
page_1
andpage_2
two different pages of the same Datatable or two different web pages? If you want to copy something from page_2 to the selected row in page_1 then userow().data()
to update the selected row. How this is done is specific to what you have.Kevin
Without using websockets or something like that to communicate between the pages, you could use the
focus
event, perhaps, and reload the table withajax.reload()
- something like this,Colin
Hi guys
Colin solution works fine, and is less complex than other solution...
In fact when opening page_2 some buttons are displayed and allow user to get it in pdf or send it by mail, opening page_2 URI with option
window.open(document.documentURI +'&P')
so transporting row().data() is a little bit complex
Thanks a lot.
Hi @colin @kthorngren @allan
Hope everybody is fine
Perhaps this post is not in good section (feature request) but I get a problem using @Colin solution so I keep this post to answer...
I place reload on window focus as :
So when I am in table with a row A selected
I click out the window
I click on row B and select it
I edit row B ... or not
Selected row will change to Row A after a few moment (at reload success)
I try
or
with no more success
I know focus event is fired before row is selected in my sample, and table reload need some time, but I'm afraid wrong row editing or else.
Is there a way to search for ?
Another point... Can you tell me where I can find information (or tell me please) how to post sample at http://live.datatables.net/ using data file ? I can see you do it, but not find how to...
Bob
It would be worth taking a look at CloudTables as this keeps the data up to date across all browser windows with the table open. This uses websockets to do this, which would be the only tidy way of guaranteeing that consistency,
Colin
This technote describes how to use the live.datatables.net environment.
Kevin
hi all
Thanks.
I'll have a complete look at technote next
For CloudTable, I'm not sure I'll can transpose complete app and test it in 15 days...
PS Is there any tutorail in french, because my poor english ?
No, sorry, all the docs are only in English I'm afraid, and yours definitely isn't poor! Good luck with the deadline,
Colin
Thanks... Don't worry. I know I'm Italian living in France...
Just for information... Is there a way in CloudTable to set a complex depend system as, for example...
I'll say "yes", as the code can be as complex as you want! I'm not sure what you're trying to do, so harder to give a more accurate answer
Colin
Hi @colin
What I expect to do is a functional software with easy user experience.
My users are all admin, and their users are final users...
For final users, interface should be simple, but multiple user can access to the same software with many different settings (with or without (you or U2) options) AND admin (my client) must access all users datas and when editing user datas, interface must be the user interface, not the admin one.
So I use PHP to create html / js / ... pages.
I'm not sure I'll can store this project in CloudTable. I do have a look at the training videos (in english )... Nice system, but actually I have no needed time to learn another new system (I discover datatable less than 2 years) and to test new application.
When this one (V 1.92 today) will be final release, I'll try CloudTable.
If you want I did create an account for Alan to have a look at test database, but there is also a lot of functions I have to implement next year (next life ?))
All case Thanks.
Realistically no, such a level of customisation isn't yet possible in CloudTables. It probably could be done, but it would be more work than getting Editor setup for your specific use case at the moment (CloudTables continues to evolve though, so in future....).
Are you using
window.open
to open the second window? If so, you can usewindow.parent
you call functions on the host page from the child page (the function just needs to be globally available on the parent). That function could then trigger a reload of the DataTable usingajax.reload()
.Allan
Hi @allan @all
In past I did try use windev, and associated, after clipper and...
I know CloudTable is the good way to create and manage applications, but it is not easy to allow in this HMI all possibility the level 0 language (C or ASM) can permit...
Nobody can say this is not.
For end user with some basic coding knowing, it will be possible to design a software themselve.
Your products are really very nice, good (apologies but I don't know term to say awesome in english) in concept an realesation, and all your team seem to be geek of this environment.
Thank you (all the team obviously) for all of those (non exclusive) points
Regards
Bob
PS you mean window.opener (because in my case (php) window.parent refer to window.self ?
Many thanks for your kind works about CloudTables and our development in general .
These are the two Javascript functions I was referring to in my last message:
I don't know how you'd do inter-window communication through PHP without a web-socket or Ajax long polling. I'm not sure it would be possible! The two Javascript functions above are how I've done inter-window communication before myself.
Have a look at this Chrome experiment to see some amazing multi-window communication.
Allan
Hi @allan
I do it using js but window.opener nor window.parent....
Working fine
Thanks
Ah yes - that will do it nicely!
Allan
Hi @allan
Have a look at this Chrome experiment to see some amazing multi-window communication.
is very nice.I remember in 1983 I did create a windows (text) system for dbase compiler (clipper Nantucket) and tools as ClockOn() and ClockOff() to get onscreen time display and ... I did use C and or interrups using asm (into clipper code) to do it.
For Autodesk products (AAD in ADN) I did use Lisp... and import German softwares like 3D-Pipe and...
BUT
It was stone age....
Today I just try to understand new worlds that comes as mushroom... each day my knowledge is less than yesterday.
Thanks
Bob