本文整理汇总了TypeScript中ag-grid-community.Utils.exists方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Utils.exists方法的具体用法?TypeScript Utils.exists怎么用?TypeScript Utils.exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ag-grid-community.Utils
的用法示例。
在下文中一共展示了Utils.exists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: populateWithoutRenderer
private populateWithoutRenderer(value: any, valueFormatted: string) {
let valueFormattedExits = valueFormatted !== null && valueFormatted !== undefined;
let valueToRender = valueFormattedExits ? valueFormatted : value;
if (Utils.exists(valueToRender) && valueToRender !== '') {
// not using innerHTML to prevent injection of HTML
// https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML#Security_considerations
this.getGui().textContent = valueToRender.toString();
} else {
// putting in blank, so if missing, at least the user can click on it
this.getGui().innerHTML = ' ';
}
}
示例2: getMenuItems
private getMenuItems(node: RowNode, column: Column, value: any): (MenuItemDef|string)[] {
let defaultMenuOptions: string[];
if (Utils.exists(node)) {
defaultMenuOptions = [];
if (column) {
// only makes sense if column exists, could have originated from a row
defaultMenuOptions = ['copy','copyWithHeaders','paste', 'separator'];
}
// if user clicks a cell
let suppressExcel = this.gridOptionsWrapper.isSuppressExcelExport();
let suppressCsv = this.gridOptionsWrapper.isSuppressCsvExport();
let onIPad = _.isUserAgentIPad();
let anyExport: boolean = !onIPad && (!suppressExcel || !suppressCsv);
if (anyExport) {
defaultMenuOptions.push('export');
}
} else {
// if user clicks outside of a cell (eg below the rows, or not rows present)
// nothing to show, perhaps tool panels???
}
if (this.gridOptionsWrapper.getContextMenuItemsFunc()) {
let userFunc: GetContextMenuItems = this.gridOptionsWrapper.getContextMenuItemsFunc();
let params: GetContextMenuItemsParams = {
node: node,
column: column,
value: value,
defaultItems: defaultMenuOptions,
api: this.gridOptionsWrapper.getApi(),
columnApi: this.gridOptionsWrapper.getColumnApi(),
context: this.gridOptionsWrapper.getContext()
};
let menuItemsFromUser = userFunc(params);
return menuItemsFromUser;
} else {
return defaultMenuOptions;
}
}