Is it possible to re-arrange the order of the dataset, not just sort it. If you
have a look at:
http://www.ducksoupdesign.net/tak/stock/
You will see that I am drawing a table on the screen from a dataset and
wanting to rearrange the the fields and redraw the table. I've placed a
datagrid on the page to show that the fields are being sorted, but it appears
when you do a while loop to get info from the dataset (starting at
prod_ds.first(); ) the order is still the same.
Is it possible to rearrage the actaul dataset?
Thanks
chaos58 - 27 Sep 2005 13:23 GMT
When you say rearanging order you mean the order of colums? If that's the case then DataGrid.addColumn() and DataGrid.addColumn() should be the way to go.
citizen-erazed - 27 Sep 2005 13:38 GMT
Hi,
Thanks for the reply, but Im not worried about rearranging the columns, I know
how to do that in the binding. Im not even going to have the datagrid on the
stage, it's just for testing. I want to rearrange the order in which data comes
out of the dataset. For example if I arrange them by name descending I would
like the function Im using to pull the info in that order and redraw the bar
graph thing I'm using to represent the data.
At the moment the function goes to the first entry and runs a while hasnext
loop, which is still pulling the info in the same order, even after a sort.
chaos58 - 27 Sep 2005 14:28 GMT
Now I get it. It's all about the bars at the top of the page. Allrighty.
You have a datagrid (DG) and sorting is done inside DG's list and not inside
your dataset (DS). Just browse through DG.getItemAt(index).column_name and you
should probably get the new sorted order. It all has to be done on
DataGrid.headerRelease event and on sort button clicks. From the usability
stand point do you really need both? Clicking on the headers should do the
trick.
Let me know if it worked!
citizen-erazed - 27 Sep 2005 14:44 GMT
Hi again
The datagrid isnt going to be on the final movie, its just there to see what
is in the dataset while testing - the sort etc. So forget that its on the
stage... So I'm actually not too sure if the DG.getItemAt(index).column_name
will work, or how it works for that matter ;)
Say, for matter of interest, that the datagrid was lpaced off the stage so it
wasnt visable on runtime, could I use the function mentioned to get a sorted
list to rebuild the bars?
I'll have a read up about that. Cheers.
chaos58 - 27 Sep 2005 16:09 GMT
If you sort the DS it should work. Till now you sorted the DG and there for DS
stayed the same. Help also mentions an event, DataSet.modelChanged that could
trigger the actual re-arranging of the bars.
Cheers.