1

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.

ICN Plugin Grid 1

ICN Plugin Grid 2

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);
}
2
  • ... So is this java or javascript?
    – Unihedron
    Commented Jul 28, 2014 at 14:58
  • 1
    Plugin makes use of both. But I do not know where the issue lies exactly, could be only on the java side of things.
    – Rikku121
    Commented Jul 28, 2014 at 15:04

2 Answers 2

1

After the document information data is saved, openItem is called. This updates the item with the latest data.

The ContentList gets the cell value from the _ModelStore.js getValue method. This method calls item.getDisplayValue to get the value to display in the cell. Most likely either item.getDisplayValue is returning null (or blank) or _ModelStore's getValue is not being called for this attribute.

I would suggest looking at the JSON being returning from openItem to verify it looks complete.

1
  • Looked around a but then decided trying out something simpler first since the issue was obviously in the attriutes' ID, I'm posting the answer in a bit, thanks though.
    – Rikku121
    Commented Jul 30, 2014 at 15:40
0

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!

Not the answer you're looking for? Browse other questions tagged or ask your own question.