blockEvent

temporarily blocks triggering of ALL events of the calling object

void blockEvent();

Example

$$('files').blockEvent();
$$('files').add({
    type:"folder", value:'New folder', date: "2014-02-10 16:10"
}, null, "documents");
$$('files').unblockEvent();

Details

Use the command with care, many actions in components are linked through events.

The most common use-case - preventing a component from repainting with each small operation:

//will repaint component 3 times
 
$$('list').add({ text:'111'});
$$('list').add({ text:'222'});
$$('list').add({ text:'333'});
 
//will repaint component only once (onStoreUpdated of List DataStore is blocked)
$$('list').data.blockEvent();
$$('list').add({ text:'111'});
$$('list').add({ text:'222'});
$$('list').add({ text:'333'});
$$('list').data.unblockEvent();
$$('list').refresh();
See also
Back to top