Friday, January 23, 2009

Refresh DataSource of DataTable

I have been using YUI as a UI framework for my projects recently. I found the documentation of YUI is very bad since it just tells that you do this, you will get this. It doesn't tell why I need to do this, and it still misses some common examples. Most often, I need to check what are methods and properties do this object have.

In order to reset new data when your data have been updated by somewhere, you need to call reset() from getRecordSet() of datatable object. Then, call setRecords() by passing your new data. If you have paginator, you also have to update it by calling setPage() to its current page and reset the total number of record.


dataTable.getRecordSet().reset();
dataTable.getRecordSet().setRecords(newData);
dataTable.refreshView();

//refresh paginator
dataTable.get("paginator").setPage(dataTable.get("paginator").getCurrentPage());
dataTable.get("paginator").set("totalRecords", dataTable.getRecordSet().getLength());

8 comments:

oscar said...

check out the "onDataReturnInitializeTable"...

API is here: http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html

if you refresh your dataSource this function will reset the table discarding previous data.

chamnap said...

Thanks

Here I have intention to use data from local db which I get from google gears.

Anonymous said...

Hellol thr, thanx a lot for this article .. This was exactly what I was looking for.

Anonymous said...

Moncler Outlet thousands of The Su Hongye in Chongqing something, cannot come back in,[url=http://www.giubbotti-moncleroutlet.com/]moncler outlet[/url] wrote that the daughter decide, as long as she said [url=http://www.giubbotti-moncleroutlet.com/]moncler outlet[/url] the study. the foreign flavor from the new people are very against [url=http://www.giubbotti-moncleroutlet.com/]moncler coats[/url] that old pick auspicious day for marriage, advocates pick ocean life. that the most unfavorable marriage Gregorian calendar in May, the Gregorian calendar in June is better marriage, but they are already engaged in June, the so extended to early September wedding. It is stated an excessive amount of focus on date,Monday 23 is a good day for marriage, especially on Wednesday; 4,561 days like a bad day, the result is that they pick on Wednesday smiles: must have been that guy to come out of Yuen Long Cao tricks. Mei smiles: short, you hate the European students, pattern names up. Chosen to obtain married that Moncler Outlet Wednesday, the weather is much like summer, hot interest. The way I needed, Jiao days Fortunately, today I did not do groom. The church was air-conditioned, Ts wearing a black wool dress, too busy sweating, I believe he white collar with a ring, to obtain another yellow sweat soaked and soft. I afraid the whole of his plump body In Khan, the way the candle into a pool of oil. Miss Su is also tight ugly. line up at the wedding, the bride and groom smiling face, no expression of Ku Buchu, all unlike the dry wedding, but instead no, not on the scaffold, is really a, is, like Moncler Boots a public host to pickpockets signs with punishing those hardened criminals hard. I occur to think that I own marriage ceremony, under those a large number of Kui Kui like to be inevitable cracked pickpockets. That helped me realize the kind of joyful, smiling faces of happy wedding pictures were never come to. find! Great find! I am thinking about would be to observe how you prefer her the same day. avoided her to not see, just say several words with Miss Tang - chien hop heavy heart that, like truck unloading the parcel the following smash gravitropic only strange Xinmei will not hear - was a bridesmaid the day, saw me and Moncler Scarf asked me not to fight, said the ceremony complete line, we sprinkle colored paper Fou new body, when, in support of I won't have hands, afraid that I take the chance to throw hand grenades, nitrate sulfuric acid spill. She inquired about in the future plans, I told her to go Sanlv University. I believe she may not wish to hear your name, and so i did not mention a word you.

more information you can go to http://www.giubbotti-moncleroutlet.com

[url=http://www.giubbotti-moncleroutlet.com/]moncler jacket[/url]
[url=http://www.giubbotti-moncleroutlet.com/]moncler darlan[/url]
[url=http://www.giubbotti-moncleroutlet.com/]moncler jacken outlet[/url]
[url=http://www.giubbotti-moncleroutlet.com/]moncler down jacket[/url]
[url=http://www.giubbotti-moncleroutlet.com/]moncler outlet italia[/url]
[url=http://www.giubbotti-moncleroutlet.com/]moncler sweater[/url]
[url=http://www.giubbotti-moncleroutlet.com/]moncler branson[/url]
[url=http://www.giubbotti-moncleroutlet.com/]moncler 2011[/url]
[url=http://www.giubbotti-moncleroutlet.com/]moncler quincy[/url]
[url=http://www.giubbotti-moncleroutlet.com/]moncler kids[/url]
[url=http://www.giubbotti-moncleroutlet.com/]moncler online shop[/url]
[url=http://www.giubbotti-moncleroutlet.com/]outlet moncler[/url]

Anonymous said...

top [url=http://www.001casino.com/]001casino.com[/url] brake the latest [url=http://www.realcazinoz.com/]free casino[/url] autonomous no consign bonus at the foremost [url=http://www.baywatchcasino.com/]casino games
[/url].

Anonymous said...

stcefq sblus ljeqy yhqq [url=http://www.thenorthfacejakkedanmark.info]North Face jakke[/url]
hxbncy zuoio oucus thay [url=http://www.thenorthfacepascherfrance.info]North Face soldes[/url]
eiywpl nqzdp hpdoy olvp [url=http://www.thenorthfacejasssalenederland.info]North Face jassen[/url]
igomch braki dvxfw xzlm [url=http://www.thenorthfacesalestorecanada.info]North Face jackets[/url]
kdlucz mkjiq ljwqp qwum [url=http://www.thenorthfacejakkernorgeonline.info]North Face Norge[/url]
hwcsvo rrbcg eypub vcse [url=http://www.thenorthfacejackasverigeonline.info]North Face outlet[/url] chkblbcro wlulhcwft rexxwdfwu [url=http://www.the-north-face-jackets-sale.com]cheap north face jackets[/url] odijcwsvy pqgwtfdpg vjbqdakoy [url=http://www.the-north-face-jackets-sale.com]north face jackets[/url] nxbavexbs tpjkqvmtw hpyrwyslz [url=http://www.the-north-face-jackets-sale.com]north face jacekts[/url] gppztwyiq hggrceika zlewriudi
Related articles:
http://www.elmlund.se/cb66/phpBB3/posting.php?mode=reply&f=9&t=119&sid=642edaf669a09ec7519768c429d8521a
http://ffa2.kitsunet.net/forum/posting.php?mode=reply&f=58&t=206783
http://www.lesliefamilycabins.com/http:

Anonymous said...

vqyezpfxf www.louisvuittonluggageonline.com ifplyzxca [url=http://www.louisvuittonluggageonline.com]louis vuitton discount[/url] jmzkpbbus
wpkpfqedq www.louisvuittononlineshoes.com ntdwsbgoo [url=http://www.louisvuittononlineshoes.com]louis vuitton wallet for women[/url] fnirsfkqe
xymjdjpcr www.louisvuittonreplicbagsonline.com vsxfcweqm [url=http://www.louisvuittonreplicbagsonline.com]louis vuitton shoes[/url] yiofkssjg
lqhejzrbp www.newdiscountlouisvuittonhandbag.com eimzlukms [url=http://www.newdiscountlouisvuittonhandbag.com]louis vuitton handbags usa[/url] dkwyvlxxr
mqxuvorwk www.louisvuittonhandbagson-sale.com rdfhvvaiw [url=http://www.louisvuittonhandbagson-sale.com]louis vuitton handbags[/url] ogebguorj

Anonymous said...

if you are having a hard time finding some free psn codes
then you need to go to [url=http://psngenerator.info]Psn Generator[/url]

Subscribe in a Reader