This blog isn't maintained anymore. Check out my current project, an agile/scrum management tool.

Tuesday, September 25, 2007

DataGrid can go DIAF

(That's "Die in a fire" for those of you not hip to texting lingo and don't have a little sister to help make you hip)


Making the DataGrid do things it's not meant to do is amazingly hard. Look at this gem that's found in the itemEditorItemEditEndHandler method:

if (event.reason == DataGridEventReason.OTHER || !event.isDefaultPrevented())
{
destroyItemEditor();
}

If the event is canceled it goes ahead and destroys your item renderer.

So if you want to say, NOT end editing and you cancel the event, it goes ahead and kills your editor anyways.

No problem... we could just override the method and fix it. Except someone on the 2.0 SDK team got private method happy with that one.

Are there any good DataGrid alternatives out there? Especially for mimicking spreadsheet functionality where you're adding and removing rows dynamically through user input?

Labels: ,

3 Comments:

  • it's getting to the point now that I nearly can hardly justify the reasoning for anything being private in a framework like this. Everytime I turn around and think "oh no problem, I'll just override that..." BAM - not today son! It's locked down like ol' farmer Jenson's daughter.

    GRRRR

    By Blogger Unknown, At 9/25/2007 2:20 PM  

  • Yeah the private thing has ticked me off quite a few times myself. Hopefully if enough people bring this up, we can get the framework changed. After all it is Open Sourced. However, in the meantime I have resorted to method that gets the job done but makes me feel very dirty. Just copy the component from the framework, create a new package called something like my.controls and go to town "publicizing" whatever methods you want.

    Man, I can hardly look at myself in the mirror :-)

    By Blogger Rob McKeown, At 9/25/2007 2:55 PM  

  • Ha yeah, I've already had to do that on one occasion, and now it's becoming the norm.

    at one point, one of the guys on the team suggested we just go ahead and compile our own SWC/version of the flex library, but we ran into some issues straight away, and abandoned that for now.

    By Blogger Unknown, At 9/25/2007 6:22 PM  

Post a Comment

Subscribe to Post Comments [Atom]



<< Home