View Full Version : ExtJS 4 and grid

18 Jun 2015, 3:53 AM
I know how to use gridpanel with database. But now I want to have tmp grid (e.g. rows with days of the week and columns with some persons information) without database connection. I prepared such a grid, with simple model, connect celledit plugin and it works.

But now I want to make some calculations on the base of data in this grid (sum, averages, etc.) so I have to read all cells in differebnt order (e.g. simple for in for) and calculate some values. Also I have to write some data in some cells. And my question is how to do it PROPERLY.

I'm not quite new but say new in ExtJS and currently I use plugins listerer 'afteredit' (function (e, data, field)) and do it by 'data.value' and 'data.record.[firld name]'. Any suggestions?

Gary Schlosberg
19 Jun 2015, 1:49 PM
I moved this thread to the Ext JS 4 forum (based on your thread title). Have you looked into the Summary feature?

21 Jun 2015, 4:08 AM
Thank you. Yes I tried to read info from Sencha site but, as for now no good idea.
I prepared a simple procedure for my, let's say calendar:

days = Ext.getStore('StoreDays').getRange();
employees = Ext.getStore('StoreTeam').getRange();

Ext.each(days, function (day) {
Ext.each(employees, function (guy) {
tmp = day.get('from');
day.set('start_' + employees.data.emp_numer, start);

... and 4 additional SET operations to grid cells
// ??? grid.getView().refresh();
It is up to 31 (month days) rows and up to 15 columns (employees).
And this procedure work ~3 minutes!!! I don't know why and how to write
proper code.
Additionally I can't refresh e.g. every single raw after raw settings as I want.
Would you be so kind as to prompt me?

21 Jun 2015, 5:15 AM
Maybe you are looking for an editable grid with summary like so:


21 Jun 2015, 10:54 PM
Thank you for suggestion but my need is simplest. I want to have a grid (32 raws x 20 columns) and I have to operate on this grid. It means e.g. sum of part of the columns, calculate average form pointed raw, etc.).
And itís not a problem to read cells and calculate something, problem is to write results of such a calculation into cells. It is very, very slow.
Additionally I have to initialize this grid on the start (just write some starting values to all of the cells (640), and time of this operation is not acceptable. I canít find alternative to getRange() and set(field, Ö) thatís why I asked for help.

24 Jun 2015, 9:42 PM
Problem is solved, I found (somewhere in the net) that I have to write: before loop (Ext.suspendLayouts()) and after (Ext.resumeLayouts(true))). Now is lasting 3 seconds.

But steel can't find info why browser (Chrome) was die (now for 3 seconds). How to refresh grid to display e.g. row by row cells with new data.

But generally my problem is solved.

I don't know (I'm novice) how to make this thread answered - sorry.