Sapui5 table column with various control template - sapui5

I implemented a table which bound to a json model.
I want to manipulate it such as one of the column be with various control types depend on the row value.
For example with some condition some rows of same column has text view control and other has dropdown list control.
I attached a sample image:
Thanks in advance!

You could also just create your custom control that renders the control you want based on a property value.
I created a simple example for you: http://jsbin.com/cafumivuco/13/edit?js,output
This has the advantage that only one control is rendered per row and not both while one is invisible.

Related

MUI DataGrid ColumnDef: the row is not available on the valueOptions prop of the column definition

I am using a DataGridPro component with different columns.
One one the columns is defined like this:
This issue is that I am trying to understand why the row is not available in the valueOptions prop of the column definition.
I would like to be able to populate the choices based on a list that is available on the row in another field.
But I get this error when I try to read the row:
Can you please help? The grid is populated with lots of rows coming from an api fetch.
Every other column is working fine accept this one.
Thank you.
I discovered that it was my bad. My column object was used twice with different parameters and so, yes, the row was not available for the second case.

AG-Grid: Add and remove columns in column groups while maintaining the state of other columns

I have a table built with AG Grid which needs to display different columns depending on the type of data we give it. This is proving slightly difficult, as I can't find a proper interface in AG Grid which allows you setup new columns in existing column groups, and without blowing up user-driven changes (hidden columns, resizing, pinning, etc).
The biggest issue is that I can't figure out how to access column group definitions.
gridOptions.api.getAllColumns()
This function from aggrid does not directly provide column groups, just the child columns. Looping through the columns via this function, they have a parent property, but that does not include the coldef for the column group, which means there isn't even really a way to reconstruct the coldef based on the data you get from it (also, the parent property is private in typescript).
Here is a rough plunker, modified from one of the ag grid documentation examples which illustrates it
https://plnkr.co/edit/C8TrwlkFDg5O5V1RJkng?p=preview
I did try having all the columns present in the table at all times, and hiding them programmatically based on the incoming data, however that creates several issues with the default column show/hide functionality (you can manually show the invalid columns). Using the initial coldefs won't work too well either, since that will discard any modifications the user has made to the columns.
Is there anyone out there who can point me in the right direction?

How to implement new item of sap.m.Table in Fiori?

I want to implement new item(row) in sap.m.Table. In Add Items section of Fiori guideline, it looks like this:
Here is my Demo
I have three questions:
How to add the new row to the first item of the table?
How to "highlighted it with a visual indicator"? (the left blue part in design)
Why addOneRow function did not work before setModel? Is it because data binding refresh the table or sth.?
1- The way I addressed this problem in several project is by using 2 tables : first tables only contains one fixed row and the second one is binded to an array. When clicking the 'add' button in the first table it resets the first table content and adds an item to the second table binding
2- the hightlight property is on the items. example:
<ColumnListItem type="Detail" highlight="Error">
if you use my solution from #1 you might use it only on first table
3- you're totally right, this is also why you should put your 'addOneRow' in the 'onAfterRendering' callback to make sure your last row (that you likely always want) is always displayed.
(btw if you use solution from #1 you simply dont need it anymore)

A treeview INSIDE OF a treeview? or how to show a list inside of a treeview

I have a treeview that lists the properties of an object. One of those properties is a list of Tags (strings) that can be a list of zero to whatever number of items. So you could tag a song with "Jazz" and "Favourite" and "Chillout" or whatever. At the moment I have these implemented as just a single string with commas separating each tag but I'd like a more intuitive user interface. All of the other properties are shown in a 2 column treeview where the first column is the property name and the second column is the property value.
It thought one way to do this would be to place another treeview inside the second column in the tags row where users can click a row to edit/delete it or there's be a "Add new tag..." row that lets them add new tags.
How could I possibly do this? Alternatively, any different GUI suggestions?
You cannot put widgets (GtkWidget) inside a column of a treeview. But you can pack several cells (GtkCellRendenderer) into a single column. A cell renderer is kind of like a lightweight widget. It can of course be subclassed so you can write your own if nothing else fits your needs.

Have a jcombobox filter a jtable

following this tutorial http://www.netbeans.org/kb/docs/java/gui-db-custom.html#enhancements
it shows how to use a textbox to filter out the master table. Could anyone instruct me on how to do a similiar thing but use a dropdown to test against a specific column?
(ie a dropdown of countries, to filter by the country column?
thanks
depending on what the source is for the dropdown.
i assume the dropdown isn't used as part of the Jtable itself, but merely shows a list of unique data coming from one column of data?
in that case, you could get the Jtable's datamodel, and then walk through all the cells in the particular column, putting them in a hashmap with the string as the key. that way you have a list of (unfiltered) unique strings to use as the datamodel for the dropdownbox.
You could attach a model listener to the talbedatamodel to know when your list has to be updated as well.