Created
October 25, 2012 13:43
-
-
Save wabson/3952617 to your computer and use it in GitHub Desktop.
Web script extension controller to add additional action(s) to data list items
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<@link rel="stylesheet" type="text/css" href="${url.context}/res/myco/components/data-lists/sample-action.css" group="datalists" /> | |
<@script type="text/javascript" src="${url.context}/res/myco/components/data-lists/sample-action.js" group="datalists"></@script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (model.widgets) | |
{ | |
for (var i = 0; i < model.widgets.length; i++) | |
{ | |
var widget = model.widgets[i]; | |
if (widget.id == "DataGrid") | |
{ | |
// These two lines only needed if you want to show the action in the 'actions' cell, | |
// otherwise a 'More actions' menu will be created to display it. | |
widget.options.splitActionsAt = 4; | |
widget.options.actionsColumnWidth = 105; // splitActionsAt * 25 + 5 | |
// Add the action definition - this will be action-specific | |
model.actionSet.push({ | |
id: "onActionSample", // Change to match your handler function name | |
type: "action-link", | |
permission: "", | |
href: "", | |
label: "actions.datalist.mycustom" // Change to match your custom label in datagrid.get.properties | |
}); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Custom action labels | |
actions.datalist.sample=My Sample Action | |
actions.datalist.sample.message=It works! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment