as3 checkbox in datagrid
I am new to Flash and AS3. I have a DataGrid like this
col1 col2 col3 col4 [checkbox] value value value [checkbox] value value value [checkbox] value value value [checkbox] value value value
Datagrid fill dynamically from mysql using services.100 record per page in datagrid. if i select some checkboxes and goto next page and select few other than come back to page 1.there should be checked checkboxes which i select previously.
I have the page 1 checkboxes value in php session and i can access these values in flash but i don't know how to set checboxes checked = true; because there is not CHANGE event occurring on checkbox.
i am using bellow class. http://www.actionscript.org/forums/showthread.php3?t=234416
Plz help me anyone
@Josh Mohan
:( no luck. Can u plz plz check the below code. and correct me how to call
CheckCellClass.onCheckChange (new Event(Event.CHANGE));
function showSearchCriteria(returnObj:Object) { // RETURN is the value from database var varName:String; for (varName in returnObj) {
/* NOTE : In this loop i want to set checkbox boxes to be checked. i mean selected = true;*/
var plid = int (returnObj[varName] ["plid"]); //THIS IS GOING TO ASSIGN TO CHECKBOX
var varState = String(returnObj[varName]["state"]);
var varCity = String(returnObj[varName]["city"]);
var varacgmeid = String(returnObj[varName]["acgmeid"]);
var varProgramname = String(retur开发者_Python百科nObj[varName]["programname"]);
var varUrl = String(returnObj[varName]["url"]);
var varNoofseats = int (returnObj[varName]["noofseats"]);
var varDeadline = String(returnObj[varName]["deadline"]);
var varYearofpassing = int (returnObj[varName]["passYear"]);
var varScore = int (returnObj[varName]["stepone2digit"]);
var varSteponeattempt = int (returnObj[varName]["steponeattempt"]);
var varObservership = int (returnObj[varName]["observership"]);
var varExternship = int (returnObj[varName]["externship"]);
var varj1h1bf1 = String(returnObj[varName]["visa"]);
var varProgramtype = String(returnObj[varName]["programtype"]);
var varComment = String(returnObj[varName]["comment"]);
var varContact = String(returnObj[varName]["contact"]);
//plid.onCheckChange (new Event(Event.CHANGE));
arrDP.push({
//Column Value
Select : plid,
State : varState,
City : varCity,
ACGMEID : varacgmeid,
ProgramName : varProgramname,
NoofnSeats : varNoofseats,
Deadline : varDeadline,
YearFromPassing : varYearofpassing,
Scores : varScore,
Attempts : varSteponeattempt,
UsExperience : varObservership,
NoofMonths : varExternship,
VisaSponsored : varj1h1bf1,
Type : varProgramtype,
More : "Show"
}); //push end here..
} //for end here..
var dp:DataProvider = new DataProvider(arrDP);
var select:DataGridColumn = dg.addColumn("Select");
var state :DataGridColumn = dg.addColumn("State");
var city :DataGridColumn = dg.addColumn("City");
var acgmeid :DataGridColumn = dg.addColumn("ACGMEID");
var programname :DataGridColumn = dg.addColumn("ProgramName");
var noofseats:DataGridColumn = dg.addColumn("NoofnSeats");
var deadline:DataGridColumn = dg.addColumn("Deadline");
var yearofpassing:DataGridColumn = dg.addColumn("YearFromPassing");
var scores:DataGridColumn = dg.addColumn("Scores");
var attempts:DataGridColumn = dg.addColumn("Attempts");
var usexperience:DataGridColumn = dg.addColumn("UsExperience");
var noofmonths:DataGridColumn = dg.addColumn("NoofMonths");
var visasponsored:DataGridColumn = dg.addColumn("VisaSponsored");
var type:DataGridColumn = dg.addColumn("Type");
var more:DataGridColumn = dg.addColumn("More");
select.cellRenderer = ButtonRenderer; //CELL RENDER FOR CHECKBOX
dg.dataProvider = dp;
}
The class you are using has overriden the Checkbox class' setter for the selected
property, thereby making it impossible to check or uncheck the box using the selected
property.
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/controls/LabelButton.html#selected
CODE:
override public function set selected(value:Boolean):void {
}
SOLUTION:
Without changing your class to allow your setter to change the selected
property of the superclass, two options are:
A) Call the event handler onCheckChange
manually and pass it a null event or dummy event:
CheckCellClass.onCheckChange (new Event(Event.CHANGE));
B) Dispatch an Event.CHANGE
event into the event stream to trigger the event handler:
CheckCellClass.dispatchEvent (new Event (Event.CHANGE));
精彩评论