flex Datagrid checkboxȫѡ
Datagrid headerRenderer checkbox to select checkboxes in the row
flex Datagrid checkboxȫѡ
Cookbooks
ÔÎÄ£ºhttp://cookbooks.adobe.com/post_Datagrid_headerRenderer_checkbox_to_select_checkbo-7262.html
ÏÂÔØ £ºsrc1.zip
CheckBoxHeaderColumn.as
package
{
import mx.controls.dataGridClasses.DataGridColumn;
[Event(name="click", type="flash.events.MouseEvent")]
public class CheckBoxHeaderColumn extends DataGridColumn
{
public function CheckBoxHeaderColumn(columnName:String=null)
{
super(columnName);
}
/**is the checkbox selected**/
public var selected:Boolean = false;
}
}
CheckBoxHeaderRenderer.as
package
{
import flash.events.MouseEvent;
import mx.controls.CheckBox;
import mx.controls.DataGrid;
import mx.events.DataGridEvent;
public class CheckBoxHeaderRenderer extends CheckBox
{
public function CheckBoxHeaderRenderer()
{
super();
//addEventListener("click", clickHandler);
}
private var _data:CheckBoxHeaderColumn;
override public function get data():Object
{
return _data;
}
override public function set data(value:Object):void
{
_data = value as CheckBoxHeaderColumn;
DataGrid(listData.owner).addEventListener(DataGridEvent.HEADER_RELEASE, sortEventHandler);
selected = _data.selected;
}
private function sortEventHandler(event:DataGridEvent):void
{
if (event.itemRenderer == this)
event.preventDefault();
}
override protected function clickHandler(event:MouseEvent):void
{
super.clickHandler(event);
data.selected = selected;
data.dispatchEvent(event);
}
}
}
CheckBoxItemRenderer.as
package
{
import flash.events.MouseEvent;
import mx.controls.Alert;
import mx.controls.CheckBox;
import mx.controls.DataGrid;
public class CheckBoxItemRenderer extends CheckBox
{
public function CheckBoxItemRenderer()
{
super();
}
override public function validateProperties():void
{
Ïà¹ØÎĵµ£º
flex¿Ø¼þ¶ÔÏó¡¢RemoteObjectµÈ¶¼ÓÐÒ»¸ö¹²Í¬µÄ·½·¨addEventListener¡£
addEventListener·½·¨ÈçÏ£º
public function addEventListener(type:String, listener:Function,
useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
{
eventDispatcher.addEventListener(type, listener, us ......
Ç°ÑÔ
C/C++µÄ¿ª·¢£¬ÄÚ´æµÄ¹ÜÀíÊÇÊ®·ÖÖØÒªµÄ¿ÎÌ⣬·ÖÅäÄÚ´æʹÓúóÒª¼°Ê±ÊÍ·Å£¬·ñÔòÄÚ´æй©µ¼ÖÂÄÚ´æºÄ¾¡¡£½øÈëÍйܻ·¾³ºó£¬ÄÚ´æÄܹ»×Ô¶¯¹ÜÀíºÍ»ØÊÕ£¬ÒѾ²»Óÿª·¢ÕßÌ«²ÙÐÄÄÚ´æ¹ÜÀí·½ÃæµÄÎÊÌâÁË£¬ÔÚÍйܻ·¾³£¬¿ª·¢ÕßÈÔÈ»¿ÉÒÔ×öһЩ¹¤×÷£¬ÌṩÄÚ´æ»ØÊÕµÄЧÂÊ£¬ÀýÈ磬°ÑÀàÄÚ²¿µÄÒýÓöÔÏóÉèÖÃΪnullÊÇ×î»ù±¾µÄ¡£½è¼øÔÚ.net»·¾³ ......
Ç°ÑÔ
Undo£¬RedoÊDZ༻·¾³Àï³£¼ûµÄ²¢Çҷdz£ÖØÒªµÄ¹¦ÄÜ£¬ÏÂÃæ½éÉÜ¡¾ÃüÁîģʽ¡¿ÔÚFlex/AS3ϵÄʵÏÖ¡£
ICommand½Ó¿Ú
¶¨ÒåICommand½Ó¿Ú£¬ÆäÖÐExecuteºÍUnExecuteÊÇÏà·´µÄ2¸ö²Ù×÷£¬TitleÊôÐÔÓÃÓÚÃüÁîÏÔʾ£¬ÀýÈçÏÔʾÔÚ²Ù×÷ÀúÊ·ÁбíÀï¡£
package cwn.wb.ui.core.command
{
import cwn.core.IDi ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="InitApp()">
<mx:Script>
<![CDATA[
......
uint int Number
Flex ËÄÉáÎåÈ룺
ÕûÊýµÄËÄÉáÎåÈë·¨£¬Math.round(Ò»¸öNumberÀàÐ͵ÄÊý)
СÊýµÄÓÐ tofixed(uint) ·½·¨
ÀýÈç var num:Number = 56.159;
num.tofixed(2); ËüÊǸöS ......