How to add a checkbox to the CDS view's filter bar - abap

I would like to add a simple checkbox to a Fiori app based on a CDS view. Clicking it would restrict the data using a parameterized table function that would return "true" or "false" for each row.
I'm unable to find any info on checkboxes in the filter bar. Is this possible using CDS annotations ?

Please check the relevant ODATA metadata, if the field of the entity is of type 'Edm.Boolean', in the Fiori, it will automatically rendered as a checkbox. You can also cast the field to ABAP boolean in CDS view if necessary.

Related

Oracle ADF - Jdeveloper use shortdesc in input from the value of another attribute of the View object

I have an input and I want to populate the shortDesc atttribute with the value of another attribute of the View Object, how can I do it?
Thanks in advance.
In the bindings on the page, create an attributeValues binding to the View Object. Then in shortDesc property, it will be:
shortDesc="#{bindings.nameOfAttributeValuesBinding.inputValue}"
As the View Object goes to a given row, the attributeValues binding updates with the value. You may need to put a partial trigger on the component so it will update when a UI action takes place depending on what you are doing.

MVC Complex ViewModel

I need to build a sample MVC UI app using Kendo UI.
I have 2 multiselect widgets for airline names and airport names respectively and below I have a grid with airline airport data.
Now when I select airlines or airports in the multiselect, upon clicking a Fetch button, the grid should refresh.
I created a ViewModel named AirlineAirportViewModel for containing List<Airlines>, List<Airports> and List<AirlineAirports>.
I instantiate the List<AirlineAirports> in the Get action method of the controller and fill the other two lists getting distinct airline and airport values from the List<AirlineAirports>.
While posting on filter button click, I am able to get action parameters as 2 List<string> types which contain only the selected multiselect items
Instead of that, I want this action parameter of type AirlineAirportViewModel so that in future, I will be able to add more filter widgets and the number of parameters stay one only.
Now, am I approaching this in the right way ? If I need the ViewModel as action parameter, where should I store the selected items from the multiselects ?

Titanium get current view on scrollableView and add an item

I have a scrollableView with several views inside and I'd like to add item to some of these view if they meet a certain criteria, like if they have data attached or not. Also I'm using Alloy, here's my markup
<ScrollableView id="scrollableView">
<View id="view" class='coolView'></View>
...
</ScrollableView>
To know if there are data attached I check the currentPage attribute like so:
function updateCurrentView(e) {
currentView = e.currentPage;
}
But I have no idea how to add an item to the current View.
Edit: To add some clarification, I have a label which when clicked allow me to choose two currencies, when chosen these currency pairs are saved in the database and should be displayed instead of the label. So my guess was to check whether the current view has currency pair saved.
There are 2 things to take care of here:
1.Whenever a currency is selected,immediately label on that particular view will change.
2.Whenever the scrollableView is loaded,it must always refer to the database if a currency is selected.
First one can be done as:
1.Get the instance of scrollableView using the getView method of alloy controller.Pass the id of the scrollableView to it.Lets call it myScrollableView.Refer this for more info.
http://docs.appcelerator.com/titanium/latest/#!/api/Alloy.Controller
2.Use var currentView=myScrollableView.getCurrentPage() to the get the current page which will be a number.
3.Now use the scrollableView instance to get all the views.
var viewArray=myScrollableView.getViews();
4.viewArray[currentView] will give you the view of current page.After you have got the view you can change the desired label using:
viewArray[currentView].children[positionOfTheView]
The "positionOfTheView" can be obtained by printing the viewArray[i].children array using Ti.API.info.
Second thing can be accomplished as follows:
1.Get the instance of scrollableView using the getView method of alloy controller.Pass the id of the scrollableView to it.Lets call it myScrollableView.Refer this for more info.
http://docs.appcelerator.com/titanium/latest/#!/api/Alloy.Controller
2.Now use the scrollableView instance to get all the views.
var viewArray=myScrollableView.getViews();
3.This is a JavaScript array of all the views in the scrollableView. Now iterate through this array and according to the data in the database,change the concerned view using:
viewArray[i].children[positionOfTheView]
The "positionOfTheView" can be obtained by printing the viewArray[i].children array using Ti.API.info.

Yii booster: how to render a cgridview inside a relation table row?

I'm using boostrap library on Yii via yii-booster
I've created a relation table view
The related view is a TbGriView itself
Vhen in a row i click on the link on the 'related' column, the row expands itself, and render a TbGridview inside it.
The problem is that the internal gridview cannot be sorte, paged or filtered, because each action on it causes that the entire container grid will empty
Note
- external grid as a id of 'extenalgrid'
- each internal grid has as id like 'internalgrid-$rowId' , so every internal grid as differnt id on div, table and table row elements.
- the action called from "render related tabel" link is using renderPartial without the postProcess option. If i use potProcess, the row will be empty
So is it not possible to rendere a full working gridview/tbgridview into a related table ?
Use different css classes for the filters, buttons and headers for the different tables. From the jquery.yiigridview.js file events are bound to selectors as $('#table-id .selector-class') so elements in your internal gridView still trigger the events bound to the external gridView. You also have to specify a different url for the internal gridView by setting it's ajaxUrl.

How to add one2many field of custom model to the tree view in Openerp?

I want to add a selection field to the form view and show the selection in tree view.
I first tried adding a custom selection field to the model but since I have many values to add to the selection field I bumped to the char(128) limit of the selection field of ir.model model.
Second I created a new custom model named x_newmodel with 3 fiedls with names x_name, x_code, x_description
added a one2many field x_newfield connecting to the x_newmodel solved the problem with the form view.
However when I try to add the new field x_newfield to the tree view I cannot get to show the data on the view.
My question is how can I add the field one2many relationship of the custom field to the tree view?
AFAIK, it is not supported.
What you could do is add a function field on your model which would compute
','.join(elem.name for elem in obj.x_newfield)
and use this in your tree display.
If you need to add a filter, you can implement the search function for your function field.