cancel
Showing results for 
Search instead for 
Did you mean: 

Move action in datalist doesn't work

mstpkha
Champ in-the-making
Champ in-the-making
Hi,
I need to customise the Alfresco datalist actions by adding a move action. I focused in the following tutoriel to acheive this :
https://github.com/share-extras/sdk-sample-datalist-action
Steps :
1- I overided the datagrid.get.config.xml file by adding the following line to it
<action type="action-link" id="onActionMoveTo"  permission="delete" label="move-row-16" />

(location : C:\Alfresco\tomcat\shared\classes\alfresco\web-extension\site-webscripts\org\alfresco\components\data-lists)
2-I added my OnActionMoveTo implementation to the files actions.js and actions-min.js located in C:\Alfresco\tomcat\webapps\share\components\data-lists
Here is the implementation of the OnActionMoveTo :

<javascript>
         /**
       * Move single document or folder.
       *
       * @method onActionMoveTo
       * @param p_items {object} Object literal representing the file or folder to be actioned
       */
      onActionMoveTo: function DataListActions_onActionMoveTo(pp_items)
      {
        var p_items = YAHOO.lang.isArray(pp_items) ? pp_items : [pp_items];
        
        console.log(p_items);
         this._copyMoveTo("move", p_items);
      },
      /**
       * Copy/Move To implementation.
       *
       * @method _copyMoveTo
       * @param mode {String} Operation mode: copy|move
       * @param p_items {object} Object literal representing the file or folder to be actioned
       * @private
       */
      _copyMoveTo: function DataListActions__copyMoveTo(mode, p_items)
      {
         // Check mode is an allowed one
         if (!mode in
            {
               copy: true,
               move: true
            })
         {
            throw new Error("'" + mode + "' is not a valid Copy/Move to mode.");
         }

         if (!this.modules.copyMoveTo)
         {
            this.modules.copyMoveTo = new Alfresco.module.DoclibCopyMoveTo(this.id + "-copyMoveTo");
         }

         var DLGF = Alfresco.module.DoclibGlobalFolder;

         var allowedViewModes =
         [
            DLGF.VIEW_MODE_RECENT_SITES,
            DLGF.VIEW_MODE_FAVOURITE_SITES,
            DLGF.VIEW_MODE_SITE,
            DLGF.VIEW_MODE_SHARED
         ];

         if (this.options.repositoryBrowsing === true)
         {
            //this block is not executed (verified by a console.log)
            allowedViewModes.push(DLGF.VIEW_MODE_REPOSITORY);
         }
         allowedViewModes.push(DLGF.VIEW_MODE_USERHOME)
         var zIndex = 0;
         if (this.fullscreen !== undefined && ( this.fullscreen.isWindowOnly || Dom.hasClass(this.id, 'alf-fullscreen')))
         {
            zIndex = 1000;
         }
         this.modules.copyMoveTo.setOptions(
         {
            allowedViewModes: allowedViewModes,
            mode: mode,
            siteId: this.options.siteId,
            containerId: this.options.containerId,
            path: this.currentPath, // this is printed as undefined in the console.log
            files: p_items,
            rootNode: this.options.rootNode, // this is printed as undefined in the console.log
            parentId: this.getParentNodeRef(p_items), // this is printed as undefined in the console.log
            zIndex: zIndex
         }).showDialog();
      },
</javascript>
When I click on the move link in the datalist, the function(OnActionMoveTo) is executed, but it doesn't show me the folder picker to move the item. When I logged the function, I found the following :
    <javascript>
            path: this.currentPath, // this is printed as undefined in the console.log
            files: p_items,
            rootNode: this.options.rootNode, // this is printed as undefined in the console.log
            parentId: this.getParentNodeRef(p_items), // this is printed as undefined in the console.log
     </javascript>
Can anyone help me to fix this, please ?
1 REPLY 1

tumelo
Champ in-the-making
Champ in-the-making
Hi, Did this end up working, am trying to empliment the same functionality