-
8 Mar 2012 2:46 AM #1
Ext.clone bug with firefox [firefox bug not expected by extjs]
Ext.clone bug with firefox [firefox bug not expected by extjs]
Sorry for the previous bad bug report.
Ext version tested:- Ext 4.0.7
- Firefox 10.0.2 (Unix)
- With a kind of Extjs own created object (I tested it with a Ext.data.Model record), when
Ext.clone executed
var type = toString.call(item);
The type of the record is and Ext.clone not clone the object and return the original item. - it is a Firefox bug: [https://bugzilla.mozilla.org/show_bug.cgi?id=684601]
Steps to reproduce the problem:- Create an Ext object ( I tested with Ext.data.Model) and debug with toString.call(obj)
The result that was expected:- [object Object]
The result that occurs instead:- [xpconnect wrapped native prototype]
var type = Object.prototype.toString.call(item);
Operating System:- Unix
Rubén Burón Rodrigo.
StackOps Developer.
-
8 Mar 2012 3:58 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
So you tried Ext.clone on a record?
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.
-
9 Mar 2012 3:47 AM #3
I only tried, I needed to clone the data of an array of records without the references, but when I see the code of clone, I realized I need to copy the data, not clone it.
Finally I use other method to "clone"(copy) the data of an array of records:
But if you create a Model manually you can check the bug with the example.PHP Code:/**
* function to return a copy of the records without references
*@param records[] array of records to copy
*@return newData[] the array with the copy of the records
*/
copyRecords : function(records){
var newData = []
Ext.Array.each(records,function(record, i)
{
newData[i] = {};
record.fields.each(function(item,index)
{
newData[i][item.name] = record.get(item.name);
});
}
return newData;
}
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote