Topic
3 replies Latest Post - ‏2014-11-24T16:00:28Z by dorothea
Alessandro.Damiani
Alessandro.Damiani
59 Posts
ACCEPTED ANSWER

Pinned topic [ICN 2.0.1, ICM 8.4] - Refresh search results after document import

‏2013-04-30T09:55:08Z |

Hi,

I would like to know if it is possible to trigger a refresh of the currently displayed search results (same behaviour as pressing the "Refresh" toolbar button) after a document import via the "Add Document" default action.

I know this requirement makes sense only if the imported document is also a match for the search criteria currently set in the search form (otherwise the content list displayed will not change upon refresh), but the customer thinks it is nevertheless important, and I can't figure out what the simplest way to achieve it could be.

If possible, I would like to avoid having to code a custom plugin action to handle the whole "add document" functionality, just to add a refresh of the content list at the end...

Thanks in advance for all the help,

Alessandro

  • Alessandro.Damiani
    Alessandro.Damiani
    59 Posts
    ACCEPTED ANSWER

    Re: [ICN 2.0.1, ICM 8.4] - Refresh search results after document import

    ‏2013-04-30T13:22:42Z  in response to Alessandro.Damiani

    I have found a solution for this, but I got there through "trial-and-error", so I would like to submit it here to understand if it makes sense.

    lang.setObject("myAddDocumentPluginAction", function (repository, items) {

            _addContentItemDialog = new AddContentItemDialog();
            // open the help file in a popup window:
            
            _addContentItemDialog.show(repository, null, true, null, function() {
                var container = dijit.byId("ecm_widget_listView_ContentList_0");
                //alert("List View: " + container);
                if (container) {
                    var resultSet = container.getResultSet();
                    if (resultSet) {
                        if (resultSet.getParentFolder && resultSet.getParentFolder() && resultSet.getParentFolder().isInstanceOf &&  resultSet.getParentFolder().isInstanceOf(ecm.model.ContentItem)) {
                            resultSet.getParentFolder().refresh();
                        } else {
                            resultSet.refresh();
                        }
                    } else {
                        if (repository) {
                            repository.refresh();
                        } else {
                            ecm.model.desktop.refresh();
                        }
                    }
                }
            });
        });

    What I did was define a custom plugin action, and instantiate the default ecm.widget.dialog.AddContentItemDialog widget from within my action js code.

    Then I added my own callback (I saw in the AddContentItemDialog code that the callback passed to the "show" method is invoked only if a new item is actually added), with the code to refresh the content list in it.

    The whole thing seems to work as desired, I would just like to know if this approach is supported.

    Also, I sort of "guessed" what the parameters to the "show" method should be, because I wasn't able to locate the call to the show method made by the default "Add Document" button, so there might be something wrong there, too...

  • damorris
    damorris
    769 Posts
    ACCEPTED ANSWER

    Re: [ICN 2.0.1, ICM 8.4] - Refresh search results after document import

    ‏2013-04-30T13:25:25Z  in response to Alessandro.Damiani

    So in the Search view or the Browse view?  The Browse view already does this.  In the search view it would be pointless unless the document added matched the criteria.  Anyway, since the Browse view does this it's already you can just take a look there to see how it's done.

  • dorothea
    dorothea
    1 Post
    ACCEPTED ANSWER

    Re: [ICN 2.0.1, ICM 8.4] - Refresh search results after document import

    ‏2014-11-24T16:00:28Z  in response to Alessandro.Damiani

    I developed in browser an action on document level: copy document. after exit from services I am calling as follwo the refresh of the desktop but the content listview of desktop is not refreshed, respectivelly no new document is displayed in the list.

    [ "dojo/_base/declare",
              "ecm/model/Action",
              "ecm/model/Request",
              "ecm/model/Desktop"....],
            function(declare, Action, Request, Desktop, ....

    {
               return declare(
                        [ Action ],
                        {......

    performAction : function(repository, itemList,
                                    callback, teamspace, resultSet, parameterMap) {
    ......

    at the end I can see in firebag the new docid and that is successfully created the new document:

     

    console.info("new guid: " + respJSON.comment);
                                        Desktop.fileIntoFolder = true;
                                        console.info("Desktop.file in folder - called ");
                                        Desktop.refresh(itemList[0].parent);
                                        console.info("Desktop.refresh selected folder - called ");
                                                
                                        Desktop.onChange(itemList[0]);
                                        console.info("onChange(itemList 0 ");

     

    Please help

    thank you