how to add action link to column tag in component.xml

nakulporwal
edited February 16, 2014 in Documentum #1

i have added my custom attribute to column tag in component.xml

<column>

  <attribute>custom attribute</attribute>

  <label>show all</label>

  <visible>true</visible>

  </column>

i want action link as value for this custom atttibute column value. how van i add action link ??

Tagged:

Best Answer

  • PanfilovAB
    edited November 11, 2013 #2 Answer ✓

    actionlink is not visible because you didn't provide required argument - objectId. The correct variant is:


    <dmf:celltemplate field='r_object_id'>
        <dmf:datagridRowTd nowrap="true" cssclass="doclistfilenamedatagrid">
            <dmfx:actionlink action="versions" label="open" showifdisabled="true" showifinvalid="true">
                <dmfx:argument name="objectId" datafield="r_object_id"/>
            </dmfx:actionlink>
        </dmf:datagridRowTd>
    </dmf:celltemplate>


    <dmf:celltemplate field='r_object_id'>
                                               <dmf:datagridRowTd nowrap="true"
                                                   cssclass="doclistfilenamedatagrid">
                                                                      <dmf:link onclick="showAllversion" label="open">
                                                                            <dmf:argument name="rObjectid" value="r_object_id" />
                                                                            </dmf:link>
                                                    </dmf:datagridRowTd>
                            </dmf:celltemplate>

    That's absolutely incorrect, to write so you should have define either a java-script function showAllversion and set runatclient tag's attrubite to true or method showAllversion in corresponding component and parse arguments by yourself.

Answers

  • PanfilovAB
    edited November 8, 2013 #3

    <column>
      <attribute>custom attribute</attribute>
      <label>show all</label>
      <visible>true</visible>
      </column>

    That part of config just defines what attributes are visible for end-user, to implement you requirement you should edit corresponding jsp, smth. like:


    <dmf:celltemplate field='custom_attribute'>
        <dmf:datagridRowTd nowrap="true" cssclass="PropListValue doclistfilenamedatagrid">
            <dmfx:actionlink action="my_action" datafield="custom_attribute">
                <dmfx:argument name="arg1" datafield="column1"/>
                <dmfx:argument name="arg2" datafield="column2"/>
            </dmfx:actionlink>
        </dmf:datagridRowTd>
    </dmf:celltemplate>
  • nakulporwal
    edited November 11, 2013 #4

    Thank you for lukng in my problem.

    whn i apply actionlink tag i didnt get link in column value.

    <dmf:celltemplate field='r_object_id'>

                                <dmf:datagridRowTd nowrap="true"

                                    cssclass="doclistfilenamedatagrid">

                                                         <dmfx:actionlink action="versions"  label="open">

                                                  <dmf:argument name="rObjectid" value="r_object_id" />

                                                   </dmfx:actionlink>

                                     </dmf:datagridRowTd>

                            </dmf:celltemplate>

    inspite of this if i use link tag i got link in column value

                             <dmf:celltemplate field='r_object_id'>

                                               <dmf:datagridRowTd nowrap="true"

                                                   cssclass="doclistfilenamedatagrid">

                                                                      <dmf:link onclick="showAllversion" label="open">

                                                                            <dmf:argument name="rObjectid" value="r_object_id" />

                                                                            </dmf:link>

                                                    </dmf:datagridRowTd>

                            </dmf:celltemplate>

    but when i click on link it show wrong num of attribue error??

  • PanfilovAB
    edited November 11, 2013 #5 Answer ✓

    actionlink is not visible because you didn't provide required argument - objectId. The correct variant is:


    <dmf:celltemplate field='r_object_id'>
        <dmf:datagridRowTd nowrap="true" cssclass="doclistfilenamedatagrid">
            <dmfx:actionlink action="versions" label="open" showifdisabled="true" showifinvalid="true">
                <dmfx:argument name="objectId" datafield="r_object_id"/>
            </dmfx:actionlink>
        </dmf:datagridRowTd>
    </dmf:celltemplate>


    <dmf:celltemplate field='r_object_id'>
                                               <dmf:datagridRowTd nowrap="true"
                                                   cssclass="doclistfilenamedatagrid">
                                                                      <dmf:link onclick="showAllversion" label="open">
                                                                            <dmf:argument name="rObjectid" value="r_object_id" />
                                                                            </dmf:link>
                                                    </dmf:datagridRowTd>
                            </dmf:celltemplate>

    That's absolutely incorrect, to write so you should have define either a java-script function showAllversion and set runatclient tag's attrubite to true or method showAllversion in corresponding component and parse arguments by yourself.

  • nakulporwal
    edited November 11, 2013 #6

    Thank you it is working fine.

    But that link option also working fine i have created a method showallversion in respective behaviour class of component

    and from that class i call component by setcomponentjump() method

  • nakulporwal
    edited December 30, 2013 #7

    I want this action link visible only when document has version for that i write precondition...

    Precondition is working fine But action link are visible in every case wether has version or not juz for the document has no version action link visible but inactive...

    do u know solution for to inc=visible the link in such case?

  • PanfilovAB
    edited December 30, 2013 #8

    Post your code, both jsp and precondition

  • nakulporwal
    edited December 30, 2013 #9

    my component in which i write action defination

    <action id="showallversions">

             <params>

                <param name="objectId" required="true"/>

             </params>

             <preconditions>

                <precondition class="com.HasVersionsPrecondition">

                </precondition>

              </preconditions>

             <execution class="com.documentum.web.formext.action.LaunchComponent">

                    <component>showallversions</component>

                    <container>Downloadversions</container>

            </execution>      

          </action>

    and jsp is

    <dmf:celltemplate field='r_object_id'>

        <dmf:datagridRowTd nowrap="true" cssclass="doclistfilenamedatagrid">

            <dmfx:actionlink action="showallversions" label="open" showifdisabled="true" showifinvalid="true" >

                <dmfx:argument name="objectId" datafield="r_object_id"/>

            </dmfx:actionlink>

        </dmf:datagridRowTd>

    </dmf:celltemplate>

    and

    package com.precondition;

    public class HasVersionsPrecondition  implements IActionPrecondition{

        @Override

        public String[] getRequiredParams() {

            // TODO Auto-generated method stub

            return null;

        }

        @Override

         public boolean queryExecute(String strAction, IConfigElement config, ArgumentList arg, Context context, Component component)

        {IDfCollection co=null;

        System.out.println("has version precondition");

        boolean flag=true;

            String objectid=arg.get("objectId");

            System.out.println(objectid);

            IDfQuery query = new DfClientX().getQuery();

            query.setDQL("select r_version_label from dm_document where r_object_id='"+objectid+"'");

            try {

                co = query.execute(component.getDfSession(), 0 );

                while(co.next()){

                String version=co.getString("r_version_label");

                System.out.println(version);

                if(version.equalsIgnoreCase("1.0")){

                    flag= false;

        

                }

               

            }

            }catch (DfException e) {

                // TODO Auto-generated catch block

                e.printStackTrace();

            }

                System.out.println("flag"+flag);

            return flag;

     

        }

    }

    It give output like

    inspite of this i want to invisible those link which are disable.

  • PanfilovAB
    edited December 30, 2013 #10

    What do you mean under "link is visible"? Is it visible but disabled (you can't click on it)? If so set showifdisabled="false" in jsp.

  • nakulporwal
    edited December 30, 2013 #11

    so if i want to hide the link if no version are available (hide those onle which are inactive) so what should i do??

  • PanfilovAB
    edited December 30, 2013 #12

    <dmf:celltemplate field='r_object_id'>

        <dmf:datagridRowTd nowrap="true" cssclass="doclistfilenamedatagrid">

            <dmfx:actionlink action="showallversions" label="open" showifdisabled="false" showifinvalid="false" >

                <dmfx:argument name="objectId" datafield="r_object_id"/>

            </dmfx:actionlink>

        </dmf:datagridRowTd>

    </dmf:celltemplate>