Posted by: Sameer on: August 6, 2007
I like the auto-re sizable functionality of the columns in most of the grids.
Common applications include Windows Explorer and File Browser in Ubuntu.
So, I decided to write my own in AdvancedDataGrid.
Here, double-clicking the separator between the headers will resize the corresponding column to fit in the contents.
Check out the sample here
Try clicking the header separator between ‘Subject’ and ‘Date’ column. This will resize the ‘Subject’ column to adjust to the
data it is showing.
Source code here -
Application .mxml file
Resizable ADG .as file
It’s nice but not usable ![]()
it’s hard to click on the separator and nobody know the functionality.
But I’m sure there is a usable solution with your nice code!
Whe must think about it.
Hi very nice functionality…
really cool…
i’ve few questions for you..
first of all
is it possible to hide a single columns header from a data grid?
Second is it possible to insert horizontal rows between data groups?
for example
data1 data2 data3
3 4 5
….blank row…….
5 6 7
….blank row…….
Thanks in advance
Lorenzo
Thanks for the reply..
no i want to to hide a single column header..
how to create my own header render?
to hyde the column header i set the headerTextField to empty string but the header always displays…
What is a dummy row?
a row without elements inside?
thanks a lot
Hy Sameer,
for example if i have a column like this
Text header
data1
data2
data3
…
i would hide name “Text header” and the field that contain it.
others question:
i have mycustomdatagrid class that extends
advanceddatagrid…
my class has various data rows..i would display the grid without a
scrollbar..so i would set the grid height equal to the number of rows
in the grid dinamically…
for example if the my grid contains 7 rows i would have a grid that has no scrollbar and displays all items at the creation…
second, in my datagrid class that extends advanceddatagrid i would have a fixed order of columns…
second my datagrid has dataprovider propertiy sets to an array of object..
for example
….
i create the equivalent array whit these object elements from as3..
when datagrid dipslays columns are not in this order: monday and tuesday..but first tuedsay and after monday…
how can i create a fixed order in my datagrid class?
thanks a lot and sorry for the english!i hope that you understand my problem…
Bye bye Lorenzo
i missed the second example!!!
mydatagrid extends AdvancedDataGrid
public function mydatagrid(arrayCollection){
this.dataprovider=arraCollection
}
where array collection is an objects array…
var obj:Object = {monday=”value”, tuesday=”value”}
tahnks again
thanks
how to create column in as3? can you send me a little example…i would create columns order from actionscript by retrieve headerfield by objects within the array…
monday tuesday …
thank you very much!!!
Hi Sameer,
thanks for the reply…
can you ask you the last question…
in your example “Auto Resizable AdvancedDataGrid” you resize columns at double click event…is it possible to modify it to create an advanceddatgrid where all the columns are perfectly resized (at datagrid creation)?How can i do this?
and is there a mechanism to retrieve single cell’s content?
thanks in advance
Regards
Lorenzo
Hi,
Great components. I have noticed that after double click flex throws a null pointer exception when column width becomes wide enough to go out of the bounds of ADG. Any ideas how to solve it?
Hi Sameer,
Problem is solved..actually it was my mistake..i am setting GRID width to its .measuresWidthOfItem on single time(initialization)..but at that time it was excuting on each data assignment..so that was my mistake only.
Thanks for your response.
one another question is that-Can we add buttons after HscrollBar and border of GRID..Actually i want to make a GRID component with inbuilt button.i have add a button on createChildren but it is display out of the grid.
Please give me suggestion.
You have amazing examples !!
One question: what is the listItems property of the datagrid, I can’t find documentation and you use it in your resizing algorithm.
Thanks!
Mike Hemelberg
Hi Sameer,
Not related to this post but I have a query , hope you could help.
I found this bug, that when i do a drag/drop in ADG , the Auto-scroll doesn’t happens like it happens in Datagrid or say TileList.
It’s like , if you try to take the feedback and drop at the end of the list, it doesnt scrolls and not allowing to drop beyond currently visible rows !!!!!!!!!
Any ideas how can i get this working
Thanks a ton
Singh
I guess I got the issue , this is how all the List based controls behave . For drop after last row , we need to have a blank row after the last row.
Just confirm for this understanding , and you have been great help.
Hi Sameer,
The links to get the sample & code are not working, Could you please send me the same?
Thanks.
Hi Sameer!
I have an ADG, 1 column, with an ArrayCollection as dataprovider; I create both dynamically, and populate the ArrayCollection with a single object.
The ADG has no header. The ADG displays the object data–it looks like a single row on the form.
ERROR–when I click on the row to edit it, it throws an error here:
AdvancedDataGridBaseEx.as:4854
var partialRow:int = (rowInfo[listItems.length - 1].y + rowInfo[listItems.length - 1].height > listContent.height) ? 1 : 0;
the listItems.length is 0 for some reason.
It’s confusing–the ADG displays the row, yet the ADG.rowCount is -1, while the AC.length is 1.
Can you help?
Thanks!
Thanks for the great post. I have one question. Does the measureText function considers the columns paddingLeft and paddingRight and gives the width or do we need to add these to the overall width.
November 6, 2007 at 2:29 pm
I like the auto-re sizeable funktion too. It´s look like very nice.