How to get the row at a specific point in Tabulator? - tabulator

In my scrolling callback I get a vertical scroll position and need the row which covers that position. Is there an API in tabulator to convert a scroll position to a row?
I tried the getRowFromPosition function, however that expects an index in the overall row list, not a position in the tabulator window.

You can call the getRows function passing in an argument of visible, this will return an array of Row Components for the currently visible rows.
If you are then looking for the top visible row you can get the first element in this array
var topRow = table.getRows("visible")[0];

Related

pdfmake empty row in the table

How to make the empty last table row disappear in pdfmake?I don't want to use dontBreakRows because I need text to break to next page if it overflows.
?

Excel Dynamic Chart Title (Top n)

Is it possible to create a dynamic Excel Pivot Chart title that includes "(Top n)" where n = the value filter row limit selected by the user? I know the chart title can be set to the contents of a cell but am unsure how to go about determining the Top n limit selected by the user or how to add that in the cell formula. If this is possible, any assistance would be greatly appreciated. Thanks!
Max didn't work as I need the row count (n) after the user applies a value filter of Top n. However, your response steered me in the right direction and I was able to accomplish what I was looking for with ="(Top "&SUBTOTAL(103, A2:A140) &")" . Supposedly, SUBTOTAL with the first parameter set to 103 will perform a COUNTA function but ignore hidden rows. Reference: https://exceljet.net/excel-functions/excel-subtotal-function
So use max() on the range of cells and concatenate - I like the & (less typing):
=(Top &MAX(A21:A24)&")"
Just for those who don't know how top get the cell result into the title:
Select the chart title box (so it has blue corners
In the formula bar type "=" and select the cell with the contents and enter.

Get Combobox Value when only one entry available

I have a Combobox on a UserForm populated with multiple values.
Based on user input I keep redefining the Combobox to less and less entries in the DropDown.
At the point where there is only one value left in the Combo Dropdown, how do I get that value to appear in the Combobox Text field?
You can access ComboBox values via the .List property.
expression.List(pvargIndex, pvargColumn)
keep in mind, the pvargIndex (row) and pvargColumn (column) do begin with the index 0.
So to the access the first element, you would use ComboBox.List(0, 0) = something
I think I've found my own solution.
The .listindex, after the fact, always comes up as -1 but each time I re-filter the combobox elements I can keep overwriting a variable within the AddItem loop with what the Combobox value is. When my count of elements = 1 then the value stored in that variable will be the last, and only, value that I was looking for.

Is it possible to display a value based on presence of a cell border?

We are looking at doing some data import. There is a very large complex sheet which has some items grouped together using borders around cells in one column. The only indication that the items are grouped is the fact the group is surrounded by a border. Items ungrouped have no left and right border on the cell (may have top and bottom border as items above and below maybe grouped). As an initial exercise we want to add a column that displays true if an item is grouped. So if there is a border display a value like one. Does anyone know if this possible?
Use this custom VBA function:
Public Function GetBorder(ByVal Rng As Range, Idx As Integer) As Boolean
GetBorder = Rng.Borders(Idx).LineStyle <> xlNone
End Function
It takes two arguments: cell and index of border (7=left, 8=bottom, 9=top, 10=right). Returns TRUE or FALSE.
Now if you want to get info about bottom border of cell A1 you should:
=GetBorder(A1,8)

Handling editing an NSTableView

I have an NSTableView backed by an NSArrayController subclass. The data displays correctly in the table when the app loads, so all is good there. I want to add a new row to the table, so I created an override for addObject to handle my custom object. When called, addObject inserts the new object into the underlying array, but the new row is the last row in the table, (makes sense, I think, as its added to the end of the underlying array), but I want the new row to be inserted as the first row. So I changed my addObject to insert the new item at index 0 (insertObject:atArrangedObjectsIndex:). Now the new row is inserted as the first row and the cell in column 0 is editable (Yeah!). BUT, when I tab to the next cell (in column 1, row 0), the selection jumps to the last row in the table and makes the cell in the second column editable. Not what I want. So how do add a new first row to my table? Make it editable without the selection switching to the last row?
I found the problem. I was programmatically sorting the table as items were added. The sort kicked in after I entered a value in the editable filed.

Resources