Sunday, March 11, 2012

DataTable into a list view plus some one-off values

Hi,

one approach could be this:

1) Bind the ListView through a DataSource. The DataSource will contain the DataTable relative to the particular page requested.

2) Write a client Pager control that basically, given a page index, the number of records per page and a delegate method, gets the DataTable and fills the DataSource. The Pager could be displayed under the ListView, and obviously can easily display all the pagination infos.

Thanks for your response. I have some more learning ahead of me before I can dig into writing the client pager control.

Would you happen to know of a starting place, (i.e. examples or doc) for writing a client control of this nature? In the mean time, I'll starting digging through the quick starts, google etc to see if there's anything out there...

Thanks much!
Chris


I think I've got it by making the following changes:

1. move my code from xml declarative script to atlas .js code, (i.e. create .js bindings instead of xml, and call web service through proxy instead of xml)

2. I should return a dataset from a web service instead of a datatable from a Dataservice so that I can include the paging information in one of the datatables and the search results in another.

3. use the atlas .js to iterate through the results and manually place them in the listview instead of the using the declaratively bound xml listview.

I think this should work - thanks for your help!

Chris


Hi,

I've finished a little pager control for one of my projects and want to share it with anyone interested. You can findthe code and an article in my blog.
Hope this helps.

Garbin, very cool, thanks for posting you code! I've got the code in a test project now and am attempting to make it work. I created a html span tag on top of my list view control and declared the pager in xml and pointed it to the span tag, (via the targetElement attribute). From there, I bound the pager control in xml to the same div tag that the list view is also bound to.

I can see that the pager control is showing up, but its not be properly bound to the listview. I'm also unclear as to how the datatable coming back from the datasource is going to contain information like total records in addition to the actual results. I had addressed this issue in my work around, (which is admitedly not the best approach as its bypassing much of benefits offered by the atlas framework) by returning a dataset from a web service which contains one data table for the results, and another for the pager control information.

Any ideas/thoughts/comments are of course welcome.

I'll keep an eye on your blog in case you're able to post a working example, (as you elluded to).

Thanks again,
Chris


Hi,

theexample is online. My approach to the total records parameter is similar to yours, but I've encapsulated it together with the data in a class declared in a web service. Let me know what you think.

Garbin, thanks very much for your postings, they've been very helpful. I've reproduced your working example. I'll play around with it and provide any feedback I have as requested.

Thanks again.

No comments:

Post a Comment