Mainaction (attribute of listing)

From JRapid

Jump to: navigation, search

"mainaction" is an attribute of listings.

When set, it overrides the default 'main' action of the active view (in 'table', doubleclicking opens the row's form; in 'basic', clicking on the row does the same).

So, if, for example, you want that your listing alerts the row id when someone clicks on it (or double click on 'table' view), you should use:

<entity name="WikiMainActionListing" label="Wiki Main Action Listing" menu="wiki">
    <property name="firstName" label="First Name" display="primary" />
    <property name="lastName" label="Last Name" display="primary"/>
    
    <listing name="simple" title="Simple List" 
        mainaction="sampleAction" />

    <action name="sampleAction" label="(label is invisible when action is 'mainaction')"
        type="javascript" function="alertRowId" />	
</entity>
	

NOTE: For this to work, you will have to define the "alertRowId" javascript function in your /webapp/Main/js/Main.js (or any other set by you):

function alertRowId( srcElem, ids ){
	alert( ids );
}

And when you fire the "main" action, instead of opening the entity's row, you'll get:

[insert screenshot here]

Personal tools