Thought I'd post this because it's kinda cool.
I'm using a jQuery Notifications plug-in... in a Tabbed UI. From an Alpha component I can create a Notification that displays on the Tabbed UI. And from the Tabbed UI I can read the Notification and mark a Notification as read... this is all part of the jQuery plug-in. None of this involves saving the Notifications across sessions. Once the Tabbed UI is closed the Notifications are lost.
I wanted to save the Notifications in a table and I also wanted control over the Notifications from a component. So... when a Notification is created, the plug-in processes it, plus I write that Notification to a table and I'm able to view those Notifications from a grid. Because the Notifications are saved in a Table I'm able to "re-process" them when the Tabbed UI gets re-displayed... so they're not lost any more.
Each Notification, when created, is an Object with each Notification getting a unique ID... and information for each Notification is written to the Tabbed UI document with it's ID... that's the way the plug-in does it.
But, the Notification Object is not saved. And I need that Object in order to work with a Notification... if I wanted to read it or delete it, in code. So I used jQuery and .Data to save each Object in it's document element.
Next, I wanted two way communication between the Notification Table and the Tabbed UI. If I read a Notification in the Tabbed UI, using the plug-in, I wanted to update the table using XBasic. Similarly, if I read a Notification in my Grid I wanted the plug-in to process that Notifcation so that the Tabbed UI would relfect the read.
Here's the order of things...
1. The Tabbed UI opens. The Tabbed UI contains an a5w_include in it's footer which runs XBasic code. The SQL table is read and jQuery statements are built. The XBasic code finished by passing back the jQuery / Javascript statements which get executed, calling the plug-in, and building the Notifications for the tabbed UI.
2. As each Notification is built by the plug-in, I also save each Notification object in the Tabbed UI document.
3. If I read a Notification from the Tabbed UI, the plug-in does the read and marks the Notification as read - but it doesn't do anything else. The plug-in does contain it's own "callback" feature. If something happens to a Notification... a read... a delete... a create... then a callback fires. The callback contains the Notification Id. In the plug-in Read callback I execute an A5_Ajax_Callback to run some Xbasic code in an A5W page. The XBasic code gets the ID passed into it by the A5_Ajax_Callback and runs a SQL Update statement, marking the Notification in the Table as read.
4. If I open up the Grid, displaying the Notification, and I click on a checkbox to Read a Notification, I fire the plug-in code to Read the Notficiation... and the Tabbed UI Notification is updated by the plug-in.
So... basically... we've got data flowing back and forth between Javascript and XBasic... and Javascript and XBasic commands are being executed... through the Tabbed UI.
The Notifications plug-in costs $4 and can be found here.
http://codecanyon.net/item/notificat...n-types/397393
I've had to modify the jQuery a bit in order to pass the Notification ID around a bit more, so if anyone purchases it I'll send you my modifications.
This is my A5_Ajax_Callback...
And this is the code in my jq_notifications.update.a5w page...
I am getting an error after this callback runs. It doesn't seem to affect anything, and my table update does happen. Here's the error... has anyone seen anything like this?
I'll post the rest of my Tabbed UI included Javascript/JQuery/XBasic code a bit later.
I'm using a jQuery Notifications plug-in... in a Tabbed UI. From an Alpha component I can create a Notification that displays on the Tabbed UI. And from the Tabbed UI I can read the Notification and mark a Notification as read... this is all part of the jQuery plug-in. None of this involves saving the Notifications across sessions. Once the Tabbed UI is closed the Notifications are lost.
I wanted to save the Notifications in a table and I also wanted control over the Notifications from a component. So... when a Notification is created, the plug-in processes it, plus I write that Notification to a table and I'm able to view those Notifications from a grid. Because the Notifications are saved in a Table I'm able to "re-process" them when the Tabbed UI gets re-displayed... so they're not lost any more.
Each Notification, when created, is an Object with each Notification getting a unique ID... and information for each Notification is written to the Tabbed UI document with it's ID... that's the way the plug-in does it.
But, the Notification Object is not saved. And I need that Object in order to work with a Notification... if I wanted to read it or delete it, in code. So I used jQuery and .Data to save each Object in it's document element.
Next, I wanted two way communication between the Notification Table and the Tabbed UI. If I read a Notification in the Tabbed UI, using the plug-in, I wanted to update the table using XBasic. Similarly, if I read a Notification in my Grid I wanted the plug-in to process that Notifcation so that the Tabbed UI would relfect the read.
Here's the order of things...
1. The Tabbed UI opens. The Tabbed UI contains an a5w_include in it's footer which runs XBasic code. The SQL table is read and jQuery statements are built. The XBasic code finished by passing back the jQuery / Javascript statements which get executed, calling the plug-in, and building the Notifications for the tabbed UI.
2. As each Notification is built by the plug-in, I also save each Notification object in the Tabbed UI document.
3. If I read a Notification from the Tabbed UI, the plug-in does the read and marks the Notification as read - but it doesn't do anything else. The plug-in does contain it's own "callback" feature. If something happens to a Notification... a read... a delete... a create... then a callback fires. The callback contains the Notification Id. In the plug-in Read callback I execute an A5_Ajax_Callback to run some Xbasic code in an A5W page. The XBasic code gets the ID passed into it by the A5_Ajax_Callback and runs a SQL Update statement, marking the Notification in the Table as read.
4. If I open up the Grid, displaying the Notification, and I click on a checkbox to Read a Notification, I fire the plug-in code to Read the Notficiation... and the Tabbed UI Notification is updated by the plug-in.
So... basically... we've got data flowing back and forth between Javascript and XBasic... and Javascript and XBasic commands are being executed... through the Tabbed UI.
The Notifications plug-in costs $4 and can be found here.
http://codecanyon.net/item/notificat...n-types/397393
I've had to modify the jQuery a bit in order to pass the Notification ID around a bit more, so if anyone purchases it I'll send you my modifications.
This is my A5_Ajax_Callback...
Code:
a5_AJAX_Callback('jq_notifications.update.a5w','action=update¬ification=' + notification.id);
Code:
<%a5 if action = "update" then dim cn as sql::Connection dim args as sql::Arguments dim rs as sql::ResultSet dim readNot as c readNot = notification sql = "update Notifications set read = '1' where Notification_ID = '" + readNot + "'" cn.open("::name::CompanyProfile") cn.PortableSQLEnabled = .t. cn.Execute(sql) cn.FreeResult() cn.close() end if %>
I'll post the rest of my Tabbed UI included Javascript/JQuery/XBasic code a bit later.
Comment