Problem adding new child row to parent row; new row always added to bottom of sheet - smartsheet-api

I'm trying to add a new indented row as a child of an existing row and it just adds a new row to the bottom of the sheet instead of indented underneath parent row.
new_row = ssc.models.Row()
new_row.cells.append({
'column_id':5050181304510340,
'parentId':1379272254089092,
'strict':False,
'value':"test_value",
})
response = ssc.Sheets.add_rows(6110498509875076, [new_row])
Thanks for any help.

Seems like you have a typo in one of the property names. Try changing parentId to parent_id instead.
Also worth mentioning that the Specify Row Location section of the docs contains some good info about how to set various row properties to specify row position. (Mentioning this here mainly for the benefit of others who may find this thread later while looking for info about row positioning).

OMFG...been working for 2 days trying to return the parent and sibling and turns out it's a typo in the docs. This post is $$$
print(row.parent_id)
print(row.sibling_id)
print(row.row_number)

Related

iText7 How do I know Table flows to next page like ITextshap Column.HasMoretext?

I have a form where I have to place some fixed data on top and bottom with a variable table in between. If table does not fit on first page, there should be created more pages as needed to acomodate Table.
But for page 2, 3, 4... I still have to print top & bottom, but this time a short version of whats was placed on page 1.
In ItextSharp5 with ColumnText.HasMoreText = true, I know when a new page is needed and can make a new page with proper top & bottom data before drop remaining table.
So how can I achieve same behaviour with iText7?
I did not found a way to know when a table needs some more room
After some reading, found a starting point at Chapter 2: Adding content to a Canvas or a Document
on 3th block of code.

How to configure agGrid grouping so it works like an accordion

is it possible to configure agGrid grouping so that it behaves like an accordion i.e. only one group can be expanded and when opening new group previously opened is closed?
Not sure if this answers your question, but I am sure this might be the only direction you'll have.
There is a method provided on gridApi - onGroupExpandedOrCollapsed
So I think (again, need to check) that this function would be called as its name suggests, and you can collapse the other rows (whichever is opened) and achieve your functionality.
Be cautious while using this as there is comment given by ag-grid
we don't really want the user calling this if one one rowNode was
expanded, instead they should be calling rowNode.setExpanded(boolean)
- this way we do a 'keepRenderedRows=false' so that the whole grid gets refreshed again - otherwise the row with the rowNodes that were
changed won't get updated, and thus the expand icon in the group cell
won't get 'opened' or 'closed'.

DevExpress set focus to specific row of VerticalGrid

My code to set the focus to a specific row of the VerticalGrid is not working.
this.ActiveControl = vGridControl1;
vGridControl1.Focus();
vGridControl1.FocusedRow = vGridControl1.GetRowByFieldName("addr1");
I have confirmed that vGridControl1.GetRowByFieldName("addr1") returns the correct row.
The first row contains a ButtonEdit, and that is where focus always goes.
The grid is in MultiRecordView but at this point contains only one (new) blank record. Adding
vGridControl1.FocusedRecord = 0;
before setting the FocusedRow doesn't make a difference.
What step am I overlooking?
Try using this which worked for me...
vGrdSummary.Focus()
vGrdSummary.FocusedRow = vGrdSummary.Rows("rowNatureOfLoss")

How to dynamically insert and remove rows

I'm looking for a widget which can be dynamically resized. I need to append and remove rows.
There are a methods coming with Grid, like gtk_grid_insert_row or gtk_grid_insert_next_to, but I don't find any xxx_remove_xxx method.
I'm developing a simple http client (to test an api). And I'm adding the possibility to append and remove "GET" variables dynamically.
The UI is made with rows containing a combobox (for variable selection), an entry (for its value) and on the last row a remove button.
Every time I set a variable, a new line (new available variable) is appended.
And every time I unset a variable, the corresponding line is removed.
thanks.
Gtk.Grid doesn't have a remove method; but Gtk.Container does. Since Grid is a Container, you can use gtk_container_remove.
The docs for this are here:
https://developer.gnome.org/gtk3/3.8/GtkContainer.html#gtk-container-remove
I think the widget you are looking for is Gtk.ListBox. It's a container so you can add and remove rows easily.

GWT 2.4 DataGrid automatic scrolling when selecting an item

I am using GWT 2.4's new DataGrid in a project. I configured the DataGrid with a pagesize of 50.
The available screen is not big enough to display all items and thus a vertical scrollbar is shown (this is actually the main purpose for using a DataGrid in the first place).
I attached a SingleSelectionModel to the DataGrid in order to be able to select items.
This works fine so far.
However I also have another widget with which the user can interact. Based on that user action a item from the DataGrid should be selected.
Sometimes the selected item is not in the visible screen region and the user has to scroll down in the DataGrid to see it.
Is there any way to automatically or manually scroll down, so that the selected item is visible?
I checked the JavaDocs of the DataGrid and found no appropriate method or function for doing that.
Don't know if this works, but you could try to get the row element for the selection and use the scrollIntoView Method.
Example Code:
dataGrid.getRowElement(INDEX_OF_SELECTED_ITEM).scrollIntoView();
The answer above works pretty well, though if the grid is wider than your window and has a horizontal scroll bar, it also scrolls all the way to the right which is pretty annoying. I was able to get it to scroll down and stay scrolled left by getting the first cell in the selected row and then having it scroll that into view.
dataGrid.getRowElement(dataGrid.getVisibleItems().indexOf(object)).getCells().getItem(0).scrollIntoView();
Don't have time to try it out, but DataGrid implements the interface HasRows, and HasRows has, among other things, a method called setVisibleRange. You just need to figure out the row number of the item that you want to focus on, and then set the visible range from that number n to n+50. That way the DataGrid will reset to put that item at the top (or near the top if it is in the last 50 elements of the list backing the DataGrid). Don't forget to redraw your DataGrid.
Have you already looked at this? If so, I'd be surprised that it didn't work.
Oh, and since this is one widget talking to another, you probably have some messaging set up and some message handlers so that when the user interacts with that second widget and "selects" the item, the message fires on the EventBus and a handler for that message fixes up the DataGrid along the lines I've described. I think you'll have to do this wiring yourself.
My solution, a little better:
dataGrid.getRow(model).scrollIntoView();
I got a Out of bounds exception doing the above.
I solved it getting the ScrollPanel in the DataGrid and used .scrollToTop() and so on on the ScrollPanel. However, to access the ScrollPanel in the DataGrid I had to use this comment:
http://code.google.com/p/google-web-toolkit/issues/detail?id=6865
As Kem pointed out, it's annoying the "scrollToRight" effect after the scrollIntoView. After me, Kem's solution gives a better behaviour than the base one as usually the first columns in a table are the more meaningful.
I improved a bit his approach, which scrolls horizontally to the first column of the row we want to be visible, by calculating the first visible column on the left before applying the scroll and then scrolling to it.
A final note: Columns absolute left is tested against "51". This is a value I found "experimentally" by looking the JS values in the browser's developer tool, I think it depends on the table's style, you may need to change/calculate it.
Below the code:
public void scrollIntoView(T next) {
int index = datagrid.getVisibleItems().indexOf(next);
NodeList<TableCellElement> cells = datagrid.getRowElement(index).getCells();
int firstVisibleIndex = -1;
for(int i=0; i<cells.getLength() && firstVisibleIndex<0;i++)
if(UIObject.isVisible(cells.getItem(i)) && (cells.getItem(i).getAbsoluteLeft() > 51) && (cells.getItem(i).getAbsoluteTop() > 0))
firstVisibleIndex = i;
cells.getItem(firstVisibleIndex>=0? firstVisibleIndex : 0).scrollIntoView();
}