dojoibm-content-navigatoribm-case-manager

Remove "MIME type" column from Filent Content List


I am Using a Script Adapter by passing payload to get contend for a Content List from "Search with values" event

enter image description here

When Contend get loaded to content list , i have a custom view to preview them. But if i clicked on MIME type column , It opens a separate view with the mapped viewer

So I need to remove this column or make it un-clickable

1) I am passing search values to content list's "Search with values" event , from where can i handle Content List's contend loading ,any Dojo Event i can use ?

2) With Script Adapter can i do this without going for a "response filter"

Edit :

As Nicely explained by "Ivo Jonker" (in his answer - "or try to specifically locate the widgets on your page" and with his example code)

responsed = page.ContentList8.ecmContentList.getResultSet();
var cols = responsed.structure.cells[0];
        for (i=cols.length-1; i>0; i--){
            var col = cols[i];

            if (col.field=="mimeTypeIcon")
                cols.splice(i,1);
        }
page.ContentList78.ecmContentList.setResultSet(responsed);

I simply remove this row. Thanks Again and lovely blog , hope you keep posting more great articles.


Solution

    1. The values passed through the Search With Values event will eventually be handled by the icm.pgwidget.contentlist.dijit.DocumentSearchHandler that in turn creates a SearchTemplate to execute the search (ecm.model.SearchTemplate.prototype.search). One option would be to aspect/before/around the DocumentSearchHandler#query to manipulat the searchresults and by that way to remove the column.

    2. The wiring however does not provide any handles to achieve this for a specific query-resultset combination leaving you to either fix this on a global scale (icm.pgwidget.contentlist.dijit.DocumentSearchHandler.prototype#query), or try to specifically locate the widgets on your page.

    Personally, taking into account #2, i'd go for the responsefilter-option if you feel the global solution wouldn't be a problem, or alternatively i'd personally prefer to create a simple ICM widget that instantiates/implements a "plain" ecm.widget.listView.ContentList and exposes a wire to set the ecm.model.Resultset.

    You'd then be able to create your own Searchquery in a scriptadapter, remove the column, and pass the resultset.

    The script adapter could be something like:

    var scriptadapter=this;
    
    var queryParams={};
        queryParams.query = "SELECT * FROM Document where id in /*your list*/";
        queryParams.retrieveAllVersions = false;
        queryParams.retrieveLatestVersion = true;
        queryParams.repository = ecm.model.desktop.repositories[0];
        queryParams.resultsDisplay = {
            "sortBy": "{NAME}",
            "sortAsc": true,
            "columns": ["{NAME}"],
            "honorNameProperty": true};
    
        var searchQuery = new ecm.model.SearchQuery(queryParams);
    
        searchQuery.search(function(response/*ecm.model.Resultset*/){
            //remove the mimeTypeIcon
            var cols = response.structure.cells[0];
            for (i=cols.length-1; i>0; i--){
                var col = cols[i];
                if (col.field=="mimeTypeIcon")
                    cols.splice(i,1);
            }
    
            //emit the resultset to your new contentlist, be sure to block the regular synchrounous output of the scriptadapter
            scriptadapter.onPublishEvent("icm.SendEventPayload",response);
    
            //The contentlist wire would simply do contentlist.setResultSet(response);
    });