-
15 Nov 2012 4:44 AM #1
Unanswered: Form loadRecord Very Slow
Unanswered: Form loadRecord Very Slow
Good day all!!! I hope this thread finds you well!!!
I'm having trouble with the form.loadRecord method. I have the following:
The form is using 'displayfield's to display the data. Here is the form layout:Code:onDependantSelectionChange: function (model, selected, eOpts) { if (selected.length) { this.getPatientExaminationDetailForm().loadRecord(selected[0]) } else { this.getPatientExaminationDetailForm().reset(); } },
My problem is that when I click on a grid row. There is a 2sec delay before the 'displayfield's display the data.Code:Ext.define('ClaimCatch_RIS.view.patient.forms.PatientDetailFieldContainer', { extend : 'Ext.form.FieldContainer', xtype : 'patientDetailFieldContainer', requires : [ 'Ext.layout.container.HBox' ], layout : { type : 'vbox', align : 'stretch' }, initComponent: function () { this.items = [{ xtype : 'fieldcontainer', layout : 'hbox', defaultType : 'displayfield', defaults : { labelAlign : 'left' }, items : [{ name : 'Title_RowID', fieldLabel : 'Title', width : 200, labelWidth : 70, renderer : function (value, metaData, record, rowIndex, colIndex, store, view) { var catRecord = Ext.getStore('Title').findRecord('Title_RowID', value); return catRecord ? catRecord.get('Title_Descr') : ''; } }, { name : 'Dependant_SName', fieldLabel : 'Surname', margin : '0 0 0 6', flex : 2 }, { xtype : 'displayfield', name : 'Dependant_FName', fieldLabel : 'First Name(s)', margin : '0 0 0 6', flex : 3 }] }, { xtype : 'fieldcontainer', layout : 'hbox', defaultType : 'displayfield', defaults : { labelAlign : 'left', grow : false }, items : [{ name : 'Gender_RowID', fieldLabel : 'Gender', width : 200, labelWidth : 70, renderer : function (value, metaData, record, rowIndex, colIndex, store, view) { var catRecord = Ext.getStore('Gender').findRecord('Gender_RowID', value); return catRecord ? catRecord.get('Gender_Descr') : ''; } }, { name : 'Relation_RowID', fieldLabel : 'Relationship', margin : '0 0 0 6', flex : 2, renderer : function (value, metaData, record, rowIndex, colIndex, store, view) { var catRecord = Ext.getStore('Relationship').findRecord('Relation_RowID', value); return catRecord ? catRecord.get('Relation_Descr') : ''; } }, { name : 'Dependant_DOB', fieldLabel : 'Date Of Birth', margin : '0 0 0 6', flex : 3, renderer : Ext.util.Format.dateRenderer('d/m/Y') }] }]; this.callParent(arguments); } });
What is causing this delay; and how can I fix it???
-
19 Nov 2012 8:40 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 435
- Answers
- 3108
First thing I see is you are doing some record lookups which depending how many stores and records you have can take some time. Past that, it shouldn't take that long and removing them things are going pretty fast for me in 4.1.3
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
20 Nov 2012 11:45 AM #3
Hi!!! Thanx for the reply...
I have tried to remove the rendering (code below):
But the rendering is still very slow. Any other suggestions???Code:Ext.define('CIS.view.patient.forms.PatientDetailFieldContainer', { extend : 'Ext.form.FieldContainer', xtype : 'patientDetailFieldContainer', requires : [ 'Ext.layout.container.HBox' ], layout : { type : 'vbox', align : 'stretch' }, initComponent: function () { this.items = [{ xtype : 'fieldcontainer', layout : 'hbox', defaultType : 'displayfield', defaults : { labelAlign : 'left' }, items : [{ name : 'Title_RowID', fieldLabel : 'Title', width : 200, labelWidth : 70//, // renderer : function (value, metaData, record, rowIndex, colIndex, store, view) // { // var catRecord = Ext.getStore('Title').findRecord('Title_RowID', value); // return catRecord ? catRecord.get('Title_Descr') : ''; // } }, { name : 'Dependant_SName', fieldLabel : 'Surname', margin : '0 0 0 6', flex : 2 }, { xtype : 'displayfield', name : 'Dependant_FName', fieldLabel : 'First Name(s)', margin : '0 0 0 6', flex : 3 }] }, { xtype : 'fieldcontainer', layout : 'hbox', defaultType : 'displayfield', defaults : { labelAlign : 'left', grow : false }, items : [{ name : 'Gender_RowID', fieldLabel : 'Gender', width : 200, labelWidth : 70//, // renderer : function (value, metaData, record, rowIndex, colIndex, store, view) // { // var catRecord = Ext.getStore('Gender').findRecord('Gender_RowID', value); // return catRecord ? catRecord.get('Gender_Descr') : ''; // } }, { name : 'Relation_RowID', fieldLabel : 'Relationship', margin : '0 0 0 6', flex : 2//, // renderer : function (value, metaData, record, rowIndex, colIndex, store, view) // { // var catRecord = Ext.getStore('Relationship').findRecord('Relation_RowID', value); // return catRecord ? catRecord.get('Relation_Descr') : ''; // } }, { name : 'Dependant_DOB', fieldLabel : 'Date Of Birth', margin : '0 0 0 6', flex : 3, renderer : Ext.util.Format.dateRenderer('d/m/Y') }] }]; this.callParent(arguments); } });
-
8 Feb 2013 4:14 AM #4
Try use
PHP Code:Ext.suspendLayouts();
this.getPatientExaminationDetailForm().loadRecord(selected[0]);
Ext.resumeLayouts(true);
-
8 Feb 2013 9:08 AM #5
The slowness is because of 'displayfield' type.
If you try to change it to any input field, it will be faster. Try and see.
This can be mainly due to the call to 'updateLayout()' in setRawValue() method of displayfield.


Reply With Quote