search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How do I set the tag field when I create the event?

Asked by Viktor
11 years ago.

I can render events today but I cant figure out how to make use of the tag-parameter.
Code:
Row row = DaypilotCommons.createEvent(
DateTime.fromDateLocal(dev.getStart().getTime()).toTimeStamp(),
DateTime.fromDateLocal(dev.getStop().getTime()).toTimeStamp(),
j+"",
dev.getType()+":"+dev.getDesc(),
r.getValue()
);
table.add(row);
setEvents(table);

Where DaypilotCommons.createEvent is:
Row row = new Row();
row.put("START", start);
row.put("END", stop);
row.put("ID", uid);
row.put("NAME", name);
row.put("TEXT", name);
row.put("RESOURCE", resourceID);
return row;

I tried adding TAG and TAGFIELD to the row but no luck.
Anybody have any ideas ?

Comment posted by Viktor
11 years ago.

While we are at it. Which parameters can I set during creation and which cant I set.

Answer posted by Viktor
11 years ago.

If you digg you shall find.
Apparently you define what "tags" should be looked for in the row object.
To define the tags i wrote this in the init-method:
setDataTagFields("mytag1, mytag2");

Then:
Row row = new Row();
row.put("START", start);
row.put("END", stop);
row.put("ID", uid);
row.put("NAME", name);
row.put("TEXT", name);
row.put("RESOURCE", resourceID);
row.put("mytag1", "this is my first tag";
row.put("mytag2", "this is my second tag";

And then in onBeforeEventRender I write:
event.tag("mytag1") to get "this is my first tag"
return row;

Answer posted by Viktor
11 years ago.

setDataTagFields("mytag1, mytag2"); should be in onPrepare otherwise it will only work at initialization.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.