Skip to content
This repository has been archived by the owner. It is now read-only.

Latest commit

 

History

History
1532 lines (1163 loc) · 29.4 KB

File metadata and controls

1532 lines (1163 loc) · 29.4 KB
layout post
title Properties, Methods and Events of ejSplitButton Widget
description API reference for SplitButton
documentation API
platform angular-api
keywords SplitButton, Essential Angular SplitButton, syncfusion, SplitButton api

ejSplitButton

The Split button allows you to perform an action using clicking the button and choosing extra options from the dropdown button. The Split button also can display both text and images.

Syntax

{% highlight html %}

{% endhighlight %}

Example

{% highlight html %}

{% endhighlight %}

Requires

  • module:jQuery

  • module:ej.core.js

  • module:ej.data.js

  • module:ej.splitbutton.js

  • module:ej.menu.js

  • module:ej.checkbox.js

N> jQuery.easing external dependency has been removed from version 14.3.0.49 onwards. Kindly include this jQuery.easing dependency for versions lesser than 14.3.0.49 in order to support animation effects.

Members

arrowPosition string|enum

{:#members:arrowposition}

Specifies the arrowPosition of the Split or Dropdown Button.See arrowPosition

Name Description
Left To set Left arrowPosition of the split button
Right To set Right arrowPosition of the split button
Top To set Top arrowPosition of the split button
Bottom To set Bottom arrowPosition of the split button

Default Value

  • ej.ArrowPosition.Right

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" text="save" [width]="500" [buttonMode]="buttonMode" [contentType]="contentType" [arrowPosition]="arrowPosition" [prefixIcon]="prefixIcon">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { contentType: any; buttonMode: any; arrowPosition: any; prefixIcon: string; constructor() { this.contentType = ej.ContentType.TextAndImage; this.buttonMode= ej.ButtonMode.Dropdown; this.arrowPosition= ej.ArrowPosition.Left; this.prefixIcon= "e-uiLight e-icon e-handup"; } }

{% endhighlight %}

buttonMode string|enum

{:#members:buttonmode}

Specifies the buttonMode like Split or Dropdown Button.See ButtonMode

Name Description
Split To specify Split mode of the button type
Dropdown To specify Dropdown mode of the button type

Default Value

  • ej.ButtonMode.Split

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" text="save" [width]="100" [buttonMode]="buttonMode" [contentType]="contentType" [prefixIcon]="prefixIcon">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { contentType: any; buttonMode: any; prefixIcon: string; constructor() { this.contentType = ej.ContentType.TextAndImage; this.buttonMode= ej.ButtonMode.Dropdown; this.prefixIcon= "e-uiLight e-icon e-handup"; } }

{% endhighlight %}

contentType string|enum

{:#members:contenttype}

Specifies the contentType of the Split Button.See ContentType

Name Description
TextOnly To specify the text contentType
ImageOnly To specify the image contentType
ImageBoth To specify the two images of contentType
TextAndImage To specify the Text and Image contentType
ImageTextImage To specify the image text and image contentType

Default Value

  • ej.ContentType.TextOnly

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" text="save" [width]="100" [contentType]="contentType">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { contentType: any; constructor() { this.contentType = ej.ContentType.TextOnly; } }

{% endhighlight %}

cssClass string

{:#members:cssclass}

Set the root class for Split Button control theme

Default Value

  • ""

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" text="save" [width]="100" [cssClass]="customCss">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { customCss: string; constructor() { this.customCss = "gradient-lime"; } }

{% endhighlight %}

enabled boolean

{:#members:enabled}

Specifies the disabling of Split Button if enabled is set to false.

Default Value

  • true

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" text="save" [width]="100" [enabled]="true">

{% endhighlight %}

enableRTL boolean

{:#members:enablertl}

Specifies the enableRTL property for Split Button while initialization.

Default Value

  • false

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" text="save" [width]="100" [enableRTL]="true">

{% endhighlight %}

height string|number

{:#members:height}

Specifies the height of the Split Button.

Default Value

  • “”

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" text="save" [width]="100" [height]="28">

{% endhighlight %}

htmlAttributes object

{:#members:htmlattributes}

Specifies the HTML Attributes of the Split Button.

Default Value

  • {}

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" text="save" [width]="100" [htmlAttributes]="htmlAttributes">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { htmlAttributes: Object; constructor() { this.htmlAttributes = {disabled:"disabled"}; } }

{% endhighlight %}

imagePosition string|enum

{:#members:imageposition}

Specifies the imagePosition of the Split Button.See imagePositions

Name Description
ImageRight To specify Left position of the split button
ImageLeft To specify Right position of the split button
ImageTop To specify Top position of the split button
ImageBottom To specify Bottom position of the split button

Default Value

  • ej.ImagePosition.ImageRight

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" text="save" [width]="100" [contentType]="contentType" [imagePosition]="imagePosition" [prefixIcon]="prefixIcon">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { contentType: any; imagePosition: any; prefixIcon: string; constructor() { this.contentType = ej.ContentType.TextAndImage; this.imagePosition= ej.ImagePosition.ImageRight; this.prefixIcon="e-uiLight e-icon e-handup"; } }

{% endhighlight %}

prefixIcon string

{:#members:prefixicon}

Specifies the image content for Split Button while initialization.

Default Value

  • ""

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" text="save" [width]="100" [contentType]="contentType" [prefixIcon]="prefixIcon">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { contentType: any; prefixIcon: string; constructor() { this.contentType = ej.ContentType.ImageOnly; this.prefixIcon="e-uiLight e-icon e-handup"; } }

{% endhighlight %}

showRoundedCorner boolean

{:#members:showroundedcorner}

Specifies the showRoundedCorner property for Split Button while initialization.

Default Value

  • false

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" text="save" [width]="100" [showRoundedCorner]="true">

{% endhighlight %}

size string|enum

{:#members:size}

Specifies the size of the Button. See ButtonSize

Name Description
Mini To specify the minimum size of the split button
Small To specify the small size of the split button
Medium To specify the medium size of the split button
Large To specify the large size of the split button
Normal To specify the normal size of the split button

Default Value

  • ej.ButtonSize.Normal

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" text="save" [width]="100" [size]="size">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { size: any; constructor() { this.size = ej.ButtonSize.Mini; } }

{% endhighlight %}

suffixIcon string

{:#members:suffixicon}

Specifies the image content for Split Button while initialization.

Default Value

  • ""

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" text="save" [width]="100" [contentType]="contentType" [prefixIcon]="prefixIcon" [suffixIcon]="suffixIcon">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { contentType: any; suffixIcon: string; prefixIcon: string; constructor() { this.contentType = ej.ContentType.ImageBoth; this.suffixIcon= "e-uiLight e-icon-padlockclosed"; this.prefixIcon= "e-uiLight e-icon-handup"; } }

{% endhighlight %}

targetID string

{:#members:targetid}

Specifies the list content for Split Button while initialization

Default Value

  • ""

Example

{% highlight html %}

<ej-splitbutton id="target1" targetID="target" [width]="100">

>

{% endhighlight %}

N> Usage of target API is recommended since targetID API is to be deprecated.

target string

{:#members:target}

Specifies the target of SplitButton menu while initialization with ID or class as a selector.

Default Value

  • ""

Example

{% highlight html %}

<ej-splitbutton id="target1" target="#target" [width]="100">

{% endhighlight %}

text string

{:#members:text}

Specifies the text content for Split Button while initialization.

Default Value

  • ""

Example

{% highlight html %}

{% endhighlight %}

width string|number

{:#members:width}

Specifies the width of the Split Button.

Default Value

  • “”

Example

{% highlight html %}

{% endhighlight %}

Methods

destroy()

{:#methods:destroy}

Destroy the split button widget all events bound using this._on will be unbind automatically and bring the control to pre-init state.

Example

{% highlight html %}

{% endhighlight %}

{% highlight ts %}

// Create instance of SplitButton

var splitObject=$("#splitButton").data("ejSplitButton"); splitObject.destroy(); // To destroy the SplitButton

{% endhighlight %}

disable()

{:#methods:disable}

To disable the split button

Example

{% highlight html %}

{% endhighlight %}

{% highlight ts %}

// Create instance of SplitButton

var splitObject=$("#splitButton").data("ejSplitButton"); splitObject.disable(); // To disable the SplitButton

{% endhighlight %}

enable()

{:#methods:enable}

To Enable the split button

Example

{% highlight html %}

{% endhighlight %}

{% highlight ts %}

// Create instance of SplitButton

var splitObject=$("#splitButton").data("ejSplitButton"); splitObject.enable(); // To enable the SplitButton

{% endhighlight %}

hide()

{:#methods:hide}

To hide the list content of the split button.

Example

{% highlight html %}

{% endhighlight %}

{% highlight ts %}

// Create instance of SplitButton

var splitObject=$("#splitButton").data("ejSplitButton"); splitObject.hide(); // To hide the SplitButton

{% endhighlight %}

show()

{:#methods:show}

To show the list content of the split button.

Example

{% highlight html %}

{% endhighlight %}

{% highlight ts %}

// Create instance of SplitButton

var splitObject=$("#splitButton").data("ejSplitButton"); splitObject.show(); // To show the SplitButton

{% endhighlight %}

Events

beforeOpen

{:#events:beforeopen}

Fires before menu of the split button control is opened.

Name Type Description
cancel boolean returns the cancel option value
model object returns the split button model
type string returns the name of the event

Example

{% highlight html %}

<ej-splitbutton id="splitButton" targetID="target" width="100" (beforeOpen)="onBeforeOpen($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { constructor() { } onBeforeOpen(e: any){ // Your code here } }

{% endhighlight %}

ejclick

{:#events:ejclick}

Fires when Button control is clicked successfully

Name Type Description
cancel boolean returns the cancel option value
model object returns the split button model
type string returns the name of the event
target object returns the target of the current object.
status boolean return the button state

Example

{% highlight html %}

<ej-splitbutton id="splitButton" targetID="target" width="100" (ejclick)="onClick($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { constructor() { } onClick(e: any){ // Your code here } }

{% endhighlight %}

close

{:#events:close}

Fires before the list content of Button control is closed

Name Type Description
cancel boolean returns the cancel option value
model object returns the split button model
type string returns the name of the event

Example

{% highlight html %}

<ej-splitbutton id="splitButton" targetID="target" width="100" (close)="onClose($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { constructor() { } onClose(e: any){ // Your code here } }

{% endhighlight %}

create

{:#events:create}

Fires after Split Button control is created.

Name Type Description
cancel boolean returns the cancel option value
model object returns the split button model
type string returns the name of the event

Example

{% highlight html %}

<ej-splitbutton id="splitButton" targetID="target" width="100" (create)="onCreate($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { constructor() { } onCreate(e: any){ // Your code here } }

{% endhighlight %}

destroy

{:#events:destroy}

Fires when the Split Button is destroyed successfully

Name Type Description
cancel boolean returns the cancel option value
model object returns the split button model
type string returns the name of the event

Example

{% highlight html %}

<ej-splitbutton id="splitButton" targetID="target" width="100" (destroy)="onDestroy($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { constructor() { } onDestroy(e: any){ // Your code here } }

{% endhighlight %}

itemMouseOut

{:#events:itemmouseout}

Fires when a menu item is Hovered out successfully

Name Type Description
cancel boolean returns the cancel option value
model object returns the split button model
type string returns the name of the event
element object returns the clicked menu item element
event object returns the event
Name Type Description
ID String return the menu item id
Text String return the clicked menu item text

Example

{% highlight html %}

<ej-splitbutton id="splitButton" targetID="target" width="100" (itemMouseOut)="onItemMouseOut($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { constructor() { } onItemMouseOut(e: any){ // Your code here } }

{% endhighlight %}

itemMouseOver

{:#events:itemmouseover}

Fires when a menu item is Hovered in successfully

Name Type Description
cancel boolean returns the cancel option value
model object returns the split button model
type string returns the name of the event
element object returns the clicked menu item element
event object returns the event
Name Type Description
ID String return the menu item id
Text String return the clicked menu item text

Example

{% highlight html %}

<ej-splitbutton id="splitButton" targetID="target" width="100" (itemMouseOver)="onItemMouseOver($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { constructor() { } onItemMouseOver(e: any){ // Your code here } }

{% endhighlight %}

itemSelected

{:#events:itemselected}

Fires when a menu item is clicked successfully

Name Type Description
cancel boolean returns the cancel option value
model object returns the split button model
type string returns the name of the event
element object returns the clicked menu item element
selectedItem object returns the selected item
menuId String return the menu id
menuText String return the clicked menu item text

Example

{% highlight html %}

<ej-splitbutton id="splitButton" targetID="target" width="100" (itemSelected)="onItemSelected($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { constructor() { } onItemSelected(e: any){ // Your code here } }

{% endhighlight %}

open

{:#events:open}

Fires before the list content of Button control is opened

Name Type Description
cancel boolean returns the cancel option value
model object returns the split button model
type string returns the name of the event

Example

{% highlight html %}

<ej-splitbutton id="splitButton" targetID="target" width="100" (open)="onOpen($event)">

{% endhighlight %}

{% highlight ts %}

export class AppComponent { constructor() { } onOpen(e: any){ // Your code here } }

{% endhighlight %}