PDA

View Full Version : Error while loading the store



lopita
6 Aug 2009, 11:57 PM
Hi,

A store has to be loaded with around 100 fields(columns) for each record.
For a single record, it loads properly.But when multiple records are selected, it takes some time and throws an errors as
"A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?"".
And the page does not load.

Is there any size limit for the store? Please reply if anyone has any idea about it

Thanks

Condor
7 Aug 2009, 12:19 AM
There is no limit on the number of records, but there is a limit on the number of javascript methods called (a kind of infinite loop detection build into the browser).

The only solution is to make your grid smaller. 100 columns is too much anyway -- which user is going to look at all of them?

Consider creating your grid with less columns and add some buttons to show different columns (you can use grid.getColumnModel.setConfig(newConfig) to change the columns).

lopita
7 Aug 2009, 12:41 AM
The grid actually shows only 20 columns of data, but we have to maintain the other 80 fields in the record as they are being used for other opertaions.

Is there any other option as splitting the single store of 100 fields into a number of small stores,each mapped with a unique id?

Or can you suggest anything else?

Thanks

Condor
7 Aug 2009, 12:52 AM
It's not the store that is the problem. The store can hold 1000s of fields.

The problem is the grid rendering. You need to show less columns and/or rows.

Options:
1. Show less columns (as already suggested).
2. Show less rows (use paging or bufferview/liveview).
3. Use simpler widget (listview).

lopita
7 Aug 2009, 12:59 AM
Hi Condor,

We are displaying only 20 fields out of 100 in the grid, the remaining are just kept in the record as we will need their values for other operations. I'm not sure if its actually a problem rendering the grid as we cannot even load two records. Could this be some other problem?

Thanks,

Lopita.

Condor
7 Aug 2009, 2:06 AM
2 records with 20 columns? That shouldn't be a problem.

I think you have an infinite loop somewhere...

lopita
8 Aug 2009, 2:53 AM
Yeah.Thanks.This seems to be a problem for infinite loop.
But i am not sure why the loop is going on for infinite times as we are implementing a simple for loop with length of number of records.
When the length is two also, it is going on and on for infinite times.
Please find the code attached..




for(var i=0; i<orderDetailsObj.ROW.length; i++){

highLevelRecord = orderDetailsObj.ROW[i].ORDER_DATA.OrderDetails.HighLevelDetails;

lowLevelRecord = orderDetailsObj.ROW[i].ORDER_DATA.OrderDetails.AllDetails;


if(lowLevelRecord.Order!=''&&lowLevelRecord.Order!=undefined&&lowLevelRecord.Order!=null){

if(lowLevelRecord.Order.Status!=''&&lowLevelRecord.Order.Status!=undefined&&lowLevelRecord.Order.Status!=null){

p_orderStatus = lowLevelRecord.Order.Status;

}else{

p_orderStatus ='';
}
..................//a lot of if loops are there for checking the remaining 95 fields


var rec =new massAmendRecord({

orderId:(highLevelRecord.OrderNo==''||highLevelRecord.OrderNo==undefined)?'': highLevelRecord.OrderNo,

version:(lowLevelRecord.Order.Version==''||lowLevelRecord.Order.Version==undefined)?'': lowLevelRecord.Order.Version,
marketingGroup: p_marketingGroup,
......................// there are around 95 more fields which are assigned in this record


});
massAmendOrdersStore.add(rec);

// There is a similar for loop for setting another smaller record in another store.
massAmendOrdersStore.commitChanges();


Could you please put some suggestion on this?

Thanks
Lopita

Animal
8 Aug 2009, 3:12 AM
How have you attempted to debug that?

lopita
8 Aug 2009, 3:15 AM
We have put alerts inside the for loop.So when the length is 2 also, the for loop is going on and on for infinite times.
Any idea why is this happening?

Animal
8 Aug 2009, 3:17 AM
alerts??

Why do you not DEBUG your code?

If you can't then why don't you hire professional web developers?

lopita
8 Aug 2009, 3:22 AM
We use normal JS alerts only for debugging.
Any idea why the loop is running for infiinite times?Is it because we are trying to manipulate huge data inside the loop?

steffenk
8 Aug 2009, 3:27 AM
We use normal JS alerts only for debugging.

then you never see the problem. Debug with Firebug!

Animal
8 Aug 2009, 3:46 AM
We use normal JS alerts only for debugging.
Any idea why the loop is running for infiinite times?Is it because we are trying to manipulate huge data inside the loop?

This is your job that you get paid for.

Step into the code with a debugger and FIND OUT!