Skip to content

Instantly share code, notes, and snippets.

@dervalp
Last active December 16, 2015 09:09
Show Gist options
  • Save dervalp/5410714 to your computer and use it in GitHub Desktop.
Save dervalp/5410714 to your computer and use it in GitHub Desktop.
define(["sitecore"], function (_sc) {
_sc.Factories.createBaseComponent({
name: "Buttongroup",
base: "BlockBase",
selector: ".sc-button-group",
attributes: [
{ name: "commands", defaultValue: [] }
],
initialize: function () {
this._super();
},
});
});
@model RenderingModel
@{
var userControl = this.Html.Sitecore().Controls().GetUserControl(this.Model.Rendering);
userControl.Class = “sc-button-group”;
}
<div @htmlAttributes>
<div class="btn-group" data-bind="foreach: actionButtonsViewModel.commands">
<button class="btn" data-bind="text: Title, attr: { class: Style, 'data-type': Category, 'data-itemuri': $root.ItemUri, 'data-command': Value }"></button>
</div>
</div>
this.DataTable.on("change:selectedCommands", function () {
var commands = this.DataTable.get("selectedCommands");
//ID_OF_THE_BUTTONGROUP is the one in showed in ROCKS
this.ID_OF_THE_BUTTONGROUP.set("commands", commands);
}, this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment