Welcome, Guest. Please login or register.
Did you miss your activation email?
05/21/12, 03:42
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  Flash Remoting with AMF (Moderators: Flash-db, Musicman, Jorge Solis, papachan, nothingGrinder)
| | |-+  How to copy a RecordSet object
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: How to copy a RecordSet object  (Read 1031 times)
hobbis
Jr. Programmer
**
Posts: 75


View Profile Email
« on: 07/04/05, 04:52 »

I'm actually trying to sort the Recordset but not display this in the DataGrid component (something going on behind the scenes) Trouble is, when I use sortItemsBy() refers to the same object and doesn't make a copy. Most times a good thing, but not this time. I want a seperate copy of the RecordSet to be used elsewhere. I have tried my good ol' copyObject function but this fails on a RecordSet for some reason:

Code:
function copyObj(o:Object) {
var _o = new o.__proto__["constructor"]();
for (var v in o) {
_o[v] = typeof (o[v]) != "object" ? o[v] : copyObj(o[v]);
}
return _o;
}

It returns undefined. I guess I could just iterate the items array and save them to a different array but that seem long winded. Any ideas?
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #1 on: 07/04/05, 05:03 »

If you're using a dataset as the middle-man, you can use an Iterators. Basically sorting on datasets works creating a new iterator (something like a pointer) and a new View, so you allways works over copies. Check dataset.getIterator in Components help.

Jorge
Logged

hobbis
Jr. Programmer
**
Posts: 75


View Profile Email
« Reply #2 on: 07/04/05, 05:29 »

Thanks Jorge. I'll have a look at that.
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!