Hi!
I have an data grid with two columns renderee as input text. all works
fine (i read some on the net), but i have two problems:
1. data grid display input text in rows, even if i don't have any
value for that row (is ugly).
2. after i input some text in and delete that row (due to my script),
value remain in next input cell. I resolve that, some how, re-renderer
columns after data is reloaded, but i don't like that solution.

This is my class for renderer column in datagrid
import mx.core.UIComponent;
import mx.controls.TextInput;
import mx.controls.DataGrid;
class TextInputCellRenderer extends UIComponent {
        var input:MovieClip;
        var listOwner:DataGrid;
        // the reference we receive to the list
        var getCellIndex:Function;
        // the function we receive from the list
        var getDataLabel:Function;
        // the function we receive from the list
        var width_input:Number;
        function TextInputCellRenderer() {
        }
        function createChildren(Void):Void {
                //This is where you can set the properties of the TextInputs 
for this column
                //For instance, you can set the maxChars and the restrict 
properties
                //And adds an eventListener for 'change' (which is defined at 
the bottom of this code),
                //so that whenever you type anything in the TextInput, it 
writes it to the dataGrid
                input = createObject("TextInput", "TextInput", 1, 
{styleName:this, owner:this});
                input.maxChars = 15;
                input.restrict = "0-9 a-z";
                input.text = "";
                input.addEventListener("change", this);
                size();
        }
        // note that setSize is implemented by UIComponent and calls size(), 
after setting
        // __width and __height
        function size(Void):Void {
                input.setSize(__width-20, 18);
                //---set this to whatever the width of the column, and the 
height of the dataGrid rows.
                input.setStyle("fontSize", 11);
                input._x = 8;
                input._y = 1;
        }
        /*
        function setValue(str:String, item:Object, sel:Boolean) : Void
        {
        //Displays the dataGrid's cell value in the TextInput
        //input._visible = (item!=undefined);
        input._visible = true;
        input.text = str;
        }
        */
        function change() {
                //----the 'change' function, which writes the textInput's input 
text into the dataGrid field that the TextInputCellRenderer is sitting in.
                listOwner.dataProvider.editField(getCellIndex().itemIndex, 
getDataLabel(), input.text);
        }
}



_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to