[]
        
(Showing Draft Content)

DsDataViewer

Class: DsDataViewer

Document Solutions Data Viewer control.

Constructors

new DsDataViewer()

new DsDataViewer(element): DsDataViewer

Document Solutions Data Viewer constructor.

Parameters

element

root container element or selector pattern used to select the root container element.

string | HTMLElement

Returns

DsDataViewer

Properties

LicenseKey

static LicenseKey: string

Product license key.

Example

<script>
 // Add your license
 DsDataViewer.LicenseKey = 'XXX';
 // Add your code
 const viewer = new DsDataViewer("#viewer");
</script>

Accessors

sidebarLayout

Get Signature

get sidebarLayout(): string[]

Get the current sidebar layout information.

Example
viewer.sidebarLayout
Returns

string[]

Set Signature

set sidebarLayout(sidebarLayout): void

Sets the sidebar layout information and modify layout. Currently supported: SearchPanel.

Example
// Open SearchPanel
viewer.sidebarLayout = ['SearchPanel'];
// Clear all sidebars
viewer.sidebarLayout = [''];
// Default sidebar layout
viewer.sidebarLayout = [];
Parameters
sidebarLayout

string[]

Returns

void


toolbarLayout

Get Signature

get toolbarLayout(): DataToolbarLayout

Get the current toolbar layout information.

Example
viewer.toolbarLayout
Returns

DataToolbarLayout

Set Signature

set toolbarLayout(buttons): void

Sets the toolbar layout information and modify layout.

Example
viewer.toolbarLayout = { default: ['open', 'zoom', 'fullscreen', 'theme-change'] }
Parameters
buttons

DataToolbarLayout

The toolbar layout information.

Returns

void

Methods

findControl()

static findControl(selector): DsDataViewer

Gets the viewer instance using the host element or host element selector

Parameters

selector

string | HTMLElement

Returns

DsDataViewer

Example

var viewer = DsDataViewer.findControl("#root");

dispose()

dispose(): void

Use this method to close and release resources occupied by the DsDataViewer.

Returns

void


getActiveSheet()

getActiveSheet(): WorkSheet

Fetches the active sheet.

Returns

WorkSheet

The active sheet instance.

Example

viewer.getActiveSheet()

getSheet()

getSheet(index): WorkSheet

Fetches the specified sheet based on the index.

Parameters

index

number

The index of the sheet to return.

Returns

WorkSheet

The specified sheet.

Example

viewer.getSheet(0)

getSheetFromName()

getSheetFromName(name): WorkSheet

Fetches the sheet with the specified name.

Parameters

name

string

The sheet name.

Returns

WorkSheet

The sheet with the specified name.

Example

viewer.getSheetFromName("Sheet1")

openFile()

openFile(file, fileType, openOptions?): void

Open data file.

Parameters

file

Blob

The data file.

fileType

FileType

The type of the imported data file.

openOptions?

The options for imported data file.

XlsxOpenOptions | SSJsonOpenOptions | CsvOpenOptions | SjsOpenOptions

Returns

void

Example

viewer.openFile("Documents/HelloWorld.xlsx", FileType.XLSX, {loadHiddenSheets: true});

showSidebar()

showSidebar(show): void

Set the visibility of the sidebar.

Parameters

show

boolean

The visibility of the sidebar.

Returns

void

Example

viewer.showSidebar(true)