Here is a remote dataSource PHP example

There are a lot of questions how to implement PHP remote data source.
Here it is an advanced example with remote sorting, paging, updating, deleting and so on.
It supports both JSON and XML data type.
Also the example shows advanced technique on using listGrid.
Later this example and similar JSP example will be explained in details.

AttachmentSize
remote_data.zip21.77 KB
dataProviderMysql.zip5.71 KB

Thanks

Thank you, this example is great. (I think that the database is a SQLite 2.1 version, and not 3 as said in the requirements)

CRUD example using Classic ASP

any sample like this using classic ASP and MSSQL.

thanks.

Working with classic ASP

Hi Nebde,

In the zip you will find a file called default.html which contains a datasource declaration:

<b:dataSource name="remote" e:behavior="b:remoteData" dataType="text/json" url="dataProviderSqlite.php" method="POST">
        <b:dataSchema identifier="id">
                <b:dataField name="Rank" select="rank" />
                <b:dataField name="Title" select="title" format="style[color:darkblue]" />
                <b:dataField name="Votes" select="votes" format="integer_groups style[color:Fuchsia]" />
                <b:dataField name="Year" select="year"  />
        </b:dataSchema>
        <e:handler event="error" type="application/javascript">
                alert(event.message)
        </e:handler>
</b:dataSource>

If you change the dataType attribute to application/xml and the url to your asp page, the data source will now post the XML from the listGrid to your asp page. You can process the XML server-side using the Microsoft XMLDOM object. You can find more info on working with XML in classic ASP here:

Hope this helps! If not, you can email me with questions regarding ASP or ASP.net: remie at backbase dot com.

Cheers,

Remie

MySQL version of PHP remote

image
MySQL version of PHP remote data provider. It also has a bit improved error handling.

Thanks a lot

Great example !!
Thanks a lot again
Niksa

Is it possible to post the code rather than zip

Hi, for some reason I'm unable to open most of the zips that are attached to forum topics. I download them and then they report an error when I try to decompress them. Is there any way you could post the source of these so we can just see at a glance really how you code these?

Zip file problem is fixed,

Zip file problem is fixed, please do not post your email address publicly.

Event onclick for listgrid header

No thanks, if you have access to my account you'll find my email there. I'm almost done as my list refreshes accurately using a combination of Javascript, PHP and MySQL. I currently use a naff combobox so that the user can select how to sort the data and explain the bug under the "help > how to use" section of the interface.

I'm now searching for how to capture the onclick when a user clicks on the headers of the listgrid as I can do the javascript from there. Also would be great of examples of how reverse sorting works and what ppl are using to trigger the switch. Anyone?

dataType

Thank you for the Zip !!!
in default.html, i changed the dataType Attribute to "application/xml"...I dont have any error message but only the last record is displayed in the listGrid.

thanks again
(my english is bad ! sorry!!)

Same Problem With Empty Zips

I encountered the same issue with corrupted .zip files. After several attempts still no luck.
Please if it's not too much trouble, please email these files to me.

Best! -Roman

-admin edit: Zip file problem is fixed, removed your email from this msg

Sorted using remotedata

I'm using version 4.2.0. Not sure if this is how the zip files above do it but this was my solution and I thought I'd post it if other ppl are having the same issues. Here is a sample of my listgrid within my index.php file (landing page):

<b:dataSource id="ds_events" name="ds_events" e:behavior="b:remoteData" url="xmls/recent_events.php" />
<b:listGrid id="lg_events" name="lg_events" dataSource="ds_events" width="100%" rowClasses="rowClass1, rowClass2" selectMultiple="false" readonly="false">
     <b:listGridCol label="Date" select="date" width="110" onclick="statusListRefresh('date')" />
     <b:listGridCol label="Service" select="service" width="85" onclick="statusListRefresh('service')" />
     <b:listGridCol label="Change" select="type" width="70" onclick="statusListRefresh('change')" />
     <b:listGridCol label="Details" select="details" onclick="statusListRefresh('details')" />
     <b:listGridCol label="User" select="userid" width="60" onclick="statusListRefresh('user')" />
</b:listGrid>

Where my javascript function statusListFresh() is:

/* Global Variables */
var Current_Order="desc"; // current state of asc or desc for sorting data
var Active_Field="date"; // current order by field
var timerStatus = self.setInterval('autoStatusListRefresh()', 60000);

/* Functions */
function statusListRefresh(sortVal) {
        if (sortVal!=Active_Field) {
                Active_Field = (sortVal==undefined) ? "date" : sortVal;
        } else {
                Current_Order = (Current_Order=="desc") ? "asc" : "desc";
        }
        var viewView = bb.getProperty(bb.document.getElementById('statusPaneView'),'value');
        var viewPeriod = bb.getProperty(bb.document.getElementById('statusPanePeriod'),'value');
        var viewDisplay = bb.getProperty(bb.document.getElementById('statusPaneDisplay'),'value');
        var viewRate = bb.getProperty(bb.document.getElementById('statusPaneRefresh'),'value');
        if (viewRate==0) {
                window.clearInterval(timerStatus);
        } else {
                viewRate*=1000;
                window.clearInterval(timerStatus);
                timerStatus = self.setInterval("autoStatusListRefresh()", viewRate);
        }
        var viewUrl = "xmls/recent_events.php?v="+viewView+"&p="+viewPeriod+"&d="+viewDisplay+"&r="+viewRate+"&o1="+Current_Order+"&o2="+Active_Field;
        bb.callMethod(bb.document.getElementById('ds_events'),'setAttribute',['url',viewUrl]);
        bb.document.getElementById('lg_events').refresh();
}
function autoStatusListRefresh() {
        bb.document.getElementById('lg_events').refresh();
        window.status='Status Pane Last Refreshed: '+ Date();
}

Where 'statusPaneView','statusPanePeriod','statusPaneDisplay','statusPaneRefresh' are b:comboBox's that I've put into a makeshift vertical toolbar...

My xml file (generated using PHP) receives the variables as it should and interestingly enough, if I sort the list by user for instance, then add a row and refresh the list, the list maintains the sort order it was in and adds the row where it belongs, even if this is the middle of the list.

Just as a background, my list is for a diary of any work done on any servers/services by our IT department. It auto-refreshes, stays up-to-date and is viewable by all IT Staff through NTLM authentication.