PDA

View Full Version : [HELP] Is it possible to load/refresh data store per row in grid ?



yehezqiel
15 Sep 2010, 7:58 PM
please help me..
i was confused, is it possible to load/refresh data store per row in grid..?

for example like this :


Grid
no name stat
1 aaaa 0 // every x second, the row should be doing query using where no=1
2 bbbb 1 // every x second, the row should be doing query using where no=2
3 cccc 2 // do nothing
4 dddd 0 // every x second, the row should be doing query using where no=0
5 eeee 2 // do nothing
....
i've tried 2 ways, but it didn't work.. :
1. i've made a task manager that run a function for every x second which collect all records, then filter which records have stat 0/1.. then the function load the data store with column no as params.

but when that task was run, it only show records where stat = 0 / 1 in grid.
i think it's because the data store was overwrite with the new one...

2. i've made a task manager that run a function for every x second which collect all records, then filter which records have stat 0/1. then the function call a DWR function with no as params.
the DWR function should return the actual value from database.
but it doesn't work..
i think it's because the DWR function can't return value into javascript variable..

somebody knows how to do it???

is it possible to use one data store per records? how?

please tell me...

thx b4...

Animal
15 Sep 2010, 9:09 PM
Loop through the selections collecting IDs

Then call reload passing that array as a parameter.

Modify your server side script to chek if that parameter is present, and if so, ignore all other params, and just return rows matchinng those IDs.

yehezqiel
15 Sep 2010, 10:34 PM
Loop through the selections collecting IDs

Then call reload passing that array as a parameter.

Modify your server side script to chek if that parameter is present, and if so, ignore all other params, and just return rows matchinng those IDs.

thank's for ur suggestion..

but that won't show all previous data, isn't it?

for example i have grid like this :
no name stat
1 aaaa 0
2 bbbb 1
3 cccc 2
4 dddd 0
5 eeee 2
....

then i want if every x second, data which column stat are 0 or 1 be reloaded from database until stat are 2..
records which stat column are 2 won't be reloaded from database..
but the grid should show all rows...

i've try to use task manager, then every x second it will run a function that loop all row and find which records are 0/1..
then i use dwr to get the current row from database, and write it in grid..
but it doesn't work.. all data which stat are 0/1 will be use the same data..

what must i do??

Animal
16 Sep 2010, 12:05 AM
Have you tried it with the add: true option?

That should attempt to add the returned recs, and because they are duplicate IDs they should take the place of previous records.

yehezqiel
16 Sep 2010, 12:54 AM
Have you tried it with the add: true option?

That should attempt to add the returned recs, and because they are duplicate IDs they should take the place of previous records.

thx..
hhmm if doing that, that's same with doing query for all data..

i mean like this example :


Grid
no name stat
1 aaaa 0 // every x second, the row should be doing query using where no=1
2 bbbb 1 // every x second, the row should be doing query using where no=2
3 cccc 2 // do nothing
4 dddd 0 // every x second, the row should be doing query using where no=4
5 eeee 2 // do nothing
if i load the data store using no as params..
it only appears one row..

animal, could you please read again my first post in this thread. I've changed it for more understandable.. :)
thx..