PDA

View Full Version : Update a cell value from database w/o update entire grid?



gustavo21
16 Jun 2011, 4:47 PM
Hi everyone. Im writing an app wich check the estate of every computers en my lan. To do this, i have a Cron job on my web server and this scripts check every hour for PC, 10 minutes for printers and 2 minutes for servers, optic links etc. If i reload all the grid everytime i wanna check the state, the app will be slow and i think it's silly to reload all data just for a single field...
Is there any way to reload just a cell o just a column w/o reload all grid?

screen:

https://lh3.googleusercontent.com/--s-ciRiK7Hw/Tfqja3YRpyI/AAAAAAAAAEk/tMwJHBMHvdM/s1024/app_rl.PNG

Thanks.

skirtle
17 Jun 2011, 9:57 AM
There are ways to do this but it sounds like premature optimization to me. Have you tried just reloading the whole grid each time? Is it really so bad? Also, how would you know which row or column to reload... why not check all of them?

One way to change a subset of the data would be to load it using an Ajax request then set it on the relevant record in the store using Ext.data.Record.set(), see the docs for more on that.

gustavo21
21 Jun 2011, 6:45 PM
I have a button in each cell to run a script and check the status (online - offline) So if im working and reload all the store is not so nice... because i just wanna know the status of this row, and reloadig change the scroll of the grid... if i am in the buttom, then i am in the top. Am i right?

skirtle
21 Jun 2011, 7:53 PM
That does make sense. As I mentioned before, you can achieve this by making an Ajax request on the button click and then using the set() method on the record.