ExtJS.Bugs

From Sixsigma
Jump to: navigation, search

ext-2.0.2\source\util\MixedCollection.js:83-84

var old = this.map[key];
if ( old ) {

Will fail if false boolean values (or other falsey values) are stored in the collection.

Suggested fix:

var old = this.map[key];
if ( typeof old !== "undefined" ) {

ext-2.0.2\source\util\MixedCollection.js:391

c[c.length] = {key: k[i], value: items[i], index: i};

Two scripted operations instead of one. Why?

Suggested fix:

c.push( {key: k[i], value: items[i], index: i} );

ext-2.0.2\source\util\MixedCollection.js

Why aren't the "private" functions '_sort' and 'createValueMatcher' stored in a closure? Rather they are exposed as part of the public interface.

ext-2.1\source\util\TaskMgr.js:10-23

Example code, lines 10 to 23, seems like a bad idea. Using a static fly-weight object from a background "thread". This only works because the scripting environment isn't actually multi-threaded.

var task = {
  run: function(){
    Ext.fly('clock').update(new Date().format('g:i:s A'));
  },
  interval: 1000 //1 second
}

ext-2.1\source\util\TaskMgr.js:108

Putting the task on the runnable queue before initialising it makes me nervous.

   this.start = function(task){
       tasks.push(task);
       task.taskStartTime = new Date().getTime();
       task.taskRunTime = 0;
       task.taskRunCount = 0;
       startThread();
       return task;
   };

Suggest:

   this.start = function(task){
       task.taskStartTime = new Date().getTime();
       task.taskRunTime = 0;
       task.taskRunCount = 0;
       tasks.push(task);
       startThread();
       return task;
   };

ext-2.1\source\data\Store.js:28-30

The getKey function can be passed in the constructor. The getKey function override implementation is identical to the default getKey implementation. Suggest: delete lines 28-30.

ext-2.1\source\widgets\grid\ColumnModel.js:374

Error: this.config[col] has no properties

Cause: in this function:

373 getColumnWidth : function(col){
374   return this.config[col].width || this.defaultWidth;
375 },

'col' does not exist in the config object. The error message is a little cryptic, given the cause. In this case by the 'autoExpandColumn' being specified as a value that didn't exist in the column model. E.g.

{
  xtype: 'grid',
  ds: ds,
  cm: cm,
  sm: sm,
  autoExpandColumn: 'non-existant-column',
  ...
}

Suggest: it'd be nice if there were a 'debug' version of ExtJS that asserted its pre/post-conditions and invariants, and that threw useful error messages.

Resolution: to avoid this problem ensure that the autoExpandColumn field, if used, contains a string that matches with an id of an item in the column model. Obviously! :)