Get last row index on Tabulator js - html-table

I want index of the last row, or total row in the table using Tabulator js. Is there any way you can get row count or index of last row?

I have come up with some digging in the documentation of Tabulator JS.
var rows = table.getRows().length;
It will give you the total number of rows.

Related

new column is the sum of two consecutive rows

please your gentile help, anyone can help me with pandas-python
I need a new column, this new column is the sum of two consecutive rows, (figure)
enter image description here
You could look at the table.assign(<new column> = <formula>) function to build out your dataframe.

add numbers down a column in OpenRefine

I'd like to automatically number a column. Similar to Excel, where I can type "1" in one cell and the cells below it automatically get numbered 2, 3, 4, 5, etc. I don't know why I'm having so much trouble figuring out this function on Openrefine but any help would be greatly appreciated.
Thanks,
Gail
You can add a new column ("Add new column based on this column") with this Grel formula inside :
row.index + 1
The answer by Ettore Rizza already provides a solution for the common case. As the question author stated in a comment it does not work for his use case. He wants to add consecutive numbers to unfiltered rows.
For this you can use records. The basic idea is to create records from the filtered data and use the record index as counter.
Steps:
With filters active add a new column with the expression value.
Move the new column to the beginning to use it as records.
With filters still active add a new column (or transform the first one) with the expression row.record.index + 1.
Original
Filtered
Records
Index
A
A
A
1
1
2
B
B
B
2
C
C
C
3

How to change column data in a Bootstrap Table column

I changed the text of a column in my Bootstrap Table through jQuery:
$('#my_td').text('45,999.54$');
When I get the row object through
var table_data = $('#my_table').bootstrapTable('getSelections');
console.log(table_data);
The last column has the old value. See screenshot. The left red square is the value I get through getSelections and the right red square is the value I changed through jQuery.
What is the right way to change the last column value and get that same value when using getSelections?
Answer exemple
This worked
$('#listing-employees-massive').bootstrapTable('updateRow', {index: row_index, row: {
identifier:value
}});
You can use the updateRow method in order to update the row info

VBA to Find all rows with numeric values and return column header

I'm trying to convert one spreadsheet that contains dates across row2 and names down column B. Each person's worked hours are listed across the rows under the date worked.
I want to convert this into lines of data in a new tab with columns: name, date, hours worked.
So far I've used VBA to pull all the names and duplicate them down column B for the number of days with hours worked (i.e. if they've worked 3 days, their name is listed 3 times). But I still need to figure out how to return the date and hours worked to the second page. The first image is the original page. Second is the desired layout.
The way I would approach this problem is to do the following:
Load the relevant range from the source sheet into an array of dimensions h x w. Let's call the array source(h, w).
This array should have the following attributes:
The top-left cell (or source(0,0)) should not have any relevant values.
The values in the left-hand column, or everything in source(x, 0), should be the names of the employees, starting with the second row (which would be source(1,0) if you are using Option Base 0, which is the default).
The values in the top row, or everything in source(0, y), should be the weeks. Again, you need to start with the second column (which would be in source(0, 1)) because the first column is empty.
The values within the rest of the array is the number of days and hours they've worked.
Create a new array that is the length h*w in length in the first dimension and 3 in length in the second dimension, and use this array to store the results of the next step.
Now that you have this array populated, you can loop through it with two nested For loops, starting with the value at source(1,1). When you are looping through this array, you will need to capture the following values:
source(x,0) - this is the employee name
source(0,y) - this is the employee week
source(x,y) - this is the number of days and hours the employee worked
Let me know if this is helpful.

ListObject.DataBodyRange.SpecialCells(xlCellTypeVisible).Rows.count returns wrong value

I have a filtered List Object and need to get the number of rows currently visible. I use this statement to get the number of lines:
MySheet.ListObjects("MyListObject").DataBodyRange.SpecialCells(xlCellTypeVisible).Rows.count
Most of the time it works. But when the table only has one or two rows visible, it always returns 1, even though it should return 2 when there are two rows. Is this a known issue? If so, are there any workarounds?
I'd rather avoid doing a manual loop through every row in the table to count, as it can be very large and this would be excessively slow.
Further info: The list object has a Totals row enabled, and is filtered with the following code:
'Remove existing filter
MySheet.ListObjects("MyListObject").Range.AutoFilter
'Apply new filter
MySheet.ListObjects("MyListObject").Range.AutoFilter Field:=1, Criteria1:=key
Where Field 1 is a (non-unique) key, and key is a String retrieved from elsewhere. I can physically see that there are two visible rows in the table (not including the header or totals row), yet .Rows.Count consistently returns 1 when there are 2 rows.
That code is incorrect - it will return the number of rows in the first visible contiguous block of cells in the filtered table. You should count the number of visible cells in one column only:
MySheet.ListObjects("MyListObject").DataBodyRange.Columns(1).SpecialCells(xlCellTypeVisible).count