aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-01-26 14:27:46 -0500
committerBobby <[email protected]>2022-01-26 14:27:46 -0500
commit586c2f8e7386e001e69ccaf89c7b200481aaec14 (patch)
tree674695b5f748d4328f7e44bda0c6f458a1fc3485
parent228960a756ec4417d5337eaacfffb9212eca2399 (diff)
downloadizuku.js-586c2f8e7386e001e69ccaf89c7b200481aaec14.tar.xz
izuku.js-586c2f8e7386e001e69ccaf89c7b200481aaec14.zip
docs: update docs for title() function
-rw-r--r--docs/frame-methods.md15
-rw-r--r--src/lib/frame.ts2
2 files changed, 17 insertions, 0 deletions
diff --git a/docs/frame-methods.md b/docs/frame-methods.md
index d830df4..c4fcef0 100644
--- a/docs/frame-methods.md
+++ b/docs/frame-methods.md
@@ -39,6 +39,21 @@ frame.header();
// frame.header([]);
```
+### `title()` ![](https://img.shields.io/badge/chainable-green.svg?style=plastic)
+
+The `title()` method is used to modify the title of the frame. Title is optional.
+
+> **Note:** If you use title method without passing any argument, it will reset the title to default title (Remember: title is optional).
+
+```js
+// modify the title
+const newTitle = 'New Title';
+frame.title(newTitle);
+
+// Reset the title to default
+frame.title();
+```
+
### `column()` ![](https://img.shields.io/badge/chainable-green.svg?style=plastic)
The `column()` method is used to get the column data of a particular column. It takes the column name or the index as an argument. It can also take an array of column names or indexes as an argument to get multiple columns.
diff --git a/src/lib/frame.ts b/src/lib/frame.ts
index 26b187e..fc23e55 100644
--- a/src/lib/frame.ts
+++ b/src/lib/frame.ts
@@ -89,6 +89,8 @@ export function generateHeader(rd: Array<any[]>): Array<string> {
export function title(this: Frame, title?: string): string | any {
if (title) {
this.tableTitle = title;
+ } else {
+ this.tableTitle = '';
}
return this;
}