Thanks PMario and Eric,
Your tips really speeded up things.
I noted that not all fields were removed, the fields that are
undefined were left untouched, so I had to give them a value first.
The store.filterTiddlers(fieldName) function I could not get to work
with custom fields, maybe a syntax problem or is it just for core
fields like tag ?
Code ====
<script>
var field_name = 'tsnip.title'; var out = '';
store.suspendNotifications();
var tids=store.getTiddlers('title');
for( i = 0 ; i < tids.length ; i++) {
if ( store.getValue(tids[i].title,field_name)!==undefined)
{
store.setValue( tids[i].title, field_name ,"-x-x-");
}
if ( tids[i].fields[field_name] ) {
delete tids[i].fields[field_name];
store.saveTiddler(tids[i].title, tids[i].title,
tids[i].text, tids[i].modifier, tids[i].modified, tids[i].tags,
tids[i].fields);
}
}
store.resumeNotifications();
store.notifyAll();
</script>
Have a nice day, Okido
On Jul 9, 1:36 am, Eric Shulman <[email protected]> wrote:
> > The conditional testing indeed speeds things up.
>
> store.saveTiddler(...) invokes store.notify(), which causes redraw
> handling to be triggered.
>
> You can prevent redraw handling from occurring during the loop by
> invoking
> store.suspendNotifications();
> before the loop, and then invoking
> store.resumeNotifications();
> store.notifyAll();
> after the loop.
>
> enjoy,
> -e
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tiddlywikidev?hl=en.