Archive

Posts Tagged ‘SQLConnection’

Some modifications on Christophe Coenraets ORM Example

February 10th, 2009

In addition to Christophe Coenraets article “Using the SQLite Database Access API in AIR Part 3″ I made some modifications to enable inline editing and update the grid imidiately after every data change.


import mx.events.DataGridEvent;
private var em:EntityManager = EntityManager.getInstance();

public function saveItem():void
{
    em.save(contact);
    parentApplication.loadContacts();
}

public function saveItemInline(event:DataGridEvent):void
{
    var field:String = event.dataField;
    contact[field] =   event.currentTarget.itemEditorInstance.text;
    em.save(contact);
}

public function deleteItem():void
{
    em.remove(contact);
    parentApplication.loadContacts();
}

public function newItem():void
{
    contact = new Contact();
}

stevie AIR 1.5, Action Script 3, Flex 3 , , , , , ,