SAPUI5 table: get none-displayed values of selected row? - sapui5

I have a SAPUI5 (OpenUI5) application with a table. This table is bound to a (JSON) model and display the name of the entity and some other attribute - but not the technical key.
The user should have the opportunity to select multiple lines in the table and the application should then be able to get the technical keys of the selected lines (probably using the underlying model).
How would I do such a thing?
Thanks in advance!

The rowSelectionChange event has a rowContext attribute. A better approach would be
rowSelectionChange: function(oEvent) {
console.log(oEvent.getParameters().rowContext.getProperty("your_key"));
}
to obtain the value of your key (or any field in the selected row by adapting the getProperty value accordingly)

when you will select a row in a table, there is a event called "rowSelectionChange". Use this event and getSelectedInedx of row.
Using the index value loop over your json and get values selected row.

Related

How to update rows / set row data in server side row model type in ag grid?

My data model looks like this. Array of objects containing title and created_date.
{
title : String
created_date: Date
}
I have defined a column definition which only renders the title. However, I'd like to sort the rows based on the created_date, without creating a created_date column. There will be an external button detached from the table, which will call the api to get the data. I am using row model type serverSide. I have the sorted data from the backend. I just need to update the data / refresh the data. How can I achieve this ? I have so far tried setRowData(updatedRows). but its giving me an error saying cannot call setRowData unless using normal row model. Is there any way to update my rows in this serverSide row model type settings ?
Calling this.gridApi.setServerSideDatasource(myDataSource); and passing in your dataSource will do the trick. Check here for details

Hide elements in list view for non active records in Filemaker

I've got a list view of a number of records. I would want to hide certain layout elements on the records which isn't the active one. Is this possible?
It should be possible with the "Hide object when"-functionality, but I'm not sure what the calculation should be.
I'm using Filemaker 13.
You can use a Script Trigger to set a global variable (e.g., $$ID) with that record's Primary Key (ID) when a record is loaded, then hide the button/layout object if not $$ID = PKID.
Adapted from the technique at http://forums.filemaker.com/posts/e591b47fdc.
Just create a statistic field in your table that counts the current number of any field that is filled in every record. An ID or timestamp would be the best guess. Then hide your portal object(s) in the inspector with "YourFieldName" <> Get(ActiveRecordNumber). Should be done.

How to Force a Sorting in a SWT Table w/ Table Viewer

I want to sort, only for the first time, a SWT Table column.
I have a Table with their TableViewer and I want to Sort programmaticaly after or before setInput Method.
The columns are dynamically generated, and the last ones is an average column.
Is there any way of Sorting by program?
I'm using only this line of code:
columnPromEcr = new TableColumn(table, SWT.RIGHT);
columnPromEcr.setText("Prom. ECR");
columnPromEcr.pack();
columnPromEcr.setResizable(true);
this.table.setSortColumn(columnPromEcr);
After setInput method I call:
// refresh table
tableViewer.refresh();
table.setRedraw(true);
Do I need a class ViewerSorter?
I don't need user intervention, my data came unordered, and after creating a dynamic column I want the program to order the table with that info, numeric data.
You don't need ViewerSorter if you only want to sort items before they are displayed. Use Comparator and Collections.sort().
Yes, use a ViewerSorter, it will keep the TableViewer in order all the time.
If u want the default behavior for sorting(integer,string simple comparison) you can just set the sorter:
viewer.setSorter(new ViewerSorter());
and the viewer will be sorted all the time (e.g. after deletions,additions of data)

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.

Axapta: Programmatically switch records in a form

In Dynamics AX 2009, how do you programmatically change to a different record in a form?
My form contains a treeview and a group of bound data fields. When clicking on a record in the tree (the data value for each item in the tree is the RecId of the item I'd like to edit in the form) I'd like to change the form to that record.
I've been using sysSetupForm as an example for working with a tree, but I'm having trouble isolating where the call to change records occurs in their code.
Thanks
Some example:
some_table table;
;
table = some_table:find(recid);
table_ds.findRecord(table); // it's a form datasource method