I'm working on an ICN plugin and having trouble fixing this glitch, every result loads the way it is supposed to on the grid widget but as soon as I make any changes to it on the right panel and save them, the grid seems to reload that row but it goes blank since it isn't loading the attributes bound to the columns I specified on the java code to build the grid.
I'm using the "Chapter 6 Creating a feature with search services and widgets" demo plugin from the ibm redbook as example, but where exactly on this sort of plugin can I make navigator load these custom columns and its attributes I want it to reload after editing?
NOTE: By default columns I mean these, attributes every row will always have by default:
row.addAttribute("ID", doc.get_Id().toString(), JSONResultSetRow.TYPE_STRING, null, doc.get_Id().toString());
row.addAttribute("className", doc.getClassName(), JSONResultSetRow.TYPE_STRING, null, doc.getClassName());
row.addAttribute("ModifiedBy", doc.get_LastModifier(), JSONResultSetRow.TYPE_STRING, null, doc.get_LastModifier());
row.addAttribute("LastModified", doc.get_DateLastModified().toString(), JSONResultSetRow.TYPE_TIMESTAMP, null, doc.get_DateLastModified().toString());
row.addAttribute("Version", doc.get_MajorVersionNumber() + "." + doc.get_MinorVersionNumber(), JSONResultSetRow.TYPE_STRING, null, doc.get_MajorVersionNumber() + "." + doc.get_MinorVersionNumber());
row.addAttribute("{NAME}", doc.get_Name(), JSONResultSetRow.TYPE_STRING, null, doc.get_Name());
row.addAttribute("ContentSize", doc.get_ContentSize(), JSONResultSetRow.TYPE_INTEGER, null, null);
And by custom I mean something like this, where everything is loaded from an XML file:
ArrayList<PluginProperty> pr = pxs.getResults(contextId);
for (int i = 0; i < pr.size(); i++) {
String id = "{" + i + "}";
String propName = pr.get(i).getName();
String propType = pr.get(i).getType();
String prop = "";
.
.
.
else if (propType.equalsIgnoreCase("StringList")) {
int size = doc.getProperties().get(propName).getStringListValue().size();
for (int j = 0; j < size; j++) {
prop += doc.getProperties().get(propName).getStringListValue().get(j).toString() + "; ";
}
}
else if (propType.equalsIgnoreCase("StringValue")) {
prop = doc.getProperties().get(propName).getStringValue();
}
.
.
.
row.addAttribute(id, prop, JSONResultSetRow.TYPE_STRING, null, prop);
}
Finally found the issue, apparently ICN does not want you to use custom IDs for your rows. I was loading a bunch of rows from an XML file and creating rows like this:
ArrayList<PluginProperty> pr = pxs.getResults(contextId);
for (int i = 0; i < pr.size(); i++) {
String id = "{" + i + "}";
String propName = pr.get(i).getName();
String propType = pr.get(i).getType();
String prop = "";
.
.
.
else if (propType.equalsIgnoreCase("StringList")) {
int size = doc.getProperties().get(propName).getStringListValue().size();
for (int j = 0; j < size; j++) {
prop += doc.getProperties().get(propName).getStringListValue().get(j).toString() + "; ";
}
}
else if (propType.equalsIgnoreCase("StringValue")) {
prop = doc.getProperties().get(propName).getStringValue();
}
.
.
.
row.addAttribute(id, prop, JSONResultSetRow.TYPE_STRING, null, prop);
}
Now to make it work I was forced to change the id variable to:
String id = pr.get(i).getName();
So that the ids will look like "Id", "DocumentTitle", "Creator", "DateCreated" and "DateLastModified", exactly like the name of each property instead of "{0}", "{1}", "{2}", etc.
Hope this might be of help to someone else!