Skip to content

Commit

Permalink
Merge pull request #407 from bubbletroubles/patch-1
Browse files Browse the repository at this point in the history
Docs: Fixed case - `datatable` to `dataTable`
  • Loading branch information
johanneswilm authored Nov 27, 2024
2 parents ea521fe + ec15136 commit 8112fca
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/documentation/rows-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Add new row data to the current instance. The `data` parameter must be an `array
```javascript
let newRow = ["column1", "column2", "column3", "column4", ...];

datatable.rows.add(newRow);
dataTable.rows.add(newRow);

```

Expand All @@ -34,7 +34,7 @@ let newRows = [
...
];

datatable.insert({data: newRows})
dataTable.insert({data: newRows})
```

---
Expand All @@ -44,7 +44,7 @@ let newRows = [
Remove existing rows from the current instance. The `select` parameter can either be an `integer` or `array` of `integers` representing the row indexes.

```javascript
let rows = datatable.rows;
let rows = dataTable.rows;

// remove the 6th row
rows.remove(5);
Expand All @@ -61,10 +61,10 @@ For example, if you're trying to remove a row that's unrendered, the `rowIndex`
Another example would be if you're currently on page 5 and you have `perPage` set to `5` the currently rendered rows have a `rowIndex` of `0`, `1`, `2`, `3` and `4`, respectively, but to remove them you would need to use the indexes `20`, `21`, `22`, `23` and `24`, respectively.

```javascript
let rows = datatable.rows;
let rows = dataTable.rows;

// Switch to page 5
datatable.page(5);
dataTable.page(5);

// WRONG: removes the first 5 rows on page 1
rows.remove([0, 1, 2, 3, 4]);
Expand All @@ -77,10 +77,10 @@ You can quickly access the correct index for the rendered row by grabbing it's `

```javascript
// Get the first rendered row
let rowToRemove = datatable.body.querySelector("tr");
let rowToRemove = dataTable.body.querySelector("tr");

// Remove it
datatable.rows.remove(parseInt(rowToRemove.dataset.index));
dataTable.rows.remove(parseInt(rowToRemove.dataset.index));

```

Expand Down

0 comments on commit 8112fca

Please sign in to comment.