I have this Fragment:
<core:FragmentDefinition xmlns:core="sap.ui.core" xmlns="sap.m">
<SelectDialog title="{i18n>titreVoiture}" search="ChercherVoiture"
confirm="fermerdialog"
cancel="fermerdialog" items="{VoitureModel>/GrosVoitures}">
<StandardListItem title="{VoitureModel>NomVoiture}" type="Active"/>
</SelectDialog>
</core:FragmentDefinition>
I am handling the selection of items. I put the selected items in an array and then when I click to open the dialog, I loop on the items and set the items manually with setSelected() if it exists in the array the problem is when I want to retrieve the items using this._valueHelpDialog.getItems().
It only returns the first 20 items, and I checked the modal and in the list it displays all the items, so I wonder why getitems() doesn't return all items.
If your entity set in gateway have 1 million records, UI5 will not lot all of them - assuming you are using an oData Model.
When your model is an ODataModel, lists by default consume the entity sets using query parameters $top and $skip. Also, by default Lists get records by blocks of 20.
As you called method "getItems" - you are getting the items in your list, not data from your model.
It's possible to use the method read of class ODataModel to read your entity set without binding it to a control however I believe reading a pottentially large data set inside you app is not ideal.
If would be helpful to share what you are trying to achieve apart from sharing your code.
Related
I'm wondering if there is a way to get all the total number of selecteditems of a table with properties growing and growingThreshold set. It seems like the call
oTable.getSelectedItems().length only works for items in the table that are on display/visible.
JSBIN Sample
getGrowingInfo().total will return all items no matter visible or not.
When growing property is set only visible items are being selected on clicking selectall.So it will return only visible items length.You may have to try for getting all items
ocheckSerialBatchJsonModel.getProperty("/results").length
If you want to get selected items you may have to add a seperate column for checkboxes and bind a property to enabled property of checkbox to json model first.Then you have to loop the entire list.
I had the same problem with sap.m.List. What I did was using the returned Listbase from the bindItems function and used the paths from getSelectedContextPaths(). Compared it with the oData and got all selected items. A little bit of a hack. Feel free to suggest something else. Didn't find anything else yet.
My HANA table consists of 20 fields but I want my view to display only 5 fields for each record in my browser through an xml view. But again, when I click on the particular row on browser, I should be able to see all 20 field for that record. How will that be possible?
That's the classic master detail pattern, and can be solved quite nicely.
In your master view, you can set the binding of your table to the OData entity set as per usual, but to limit the number of fields being transferred, you should use the select parameter:
items="{
path: '/AwesomeStuff',
parameters: {
select: 'Id,Name'
}
}"
The press event of your ColumnListItem in the table should be implemented and in that event handler it would be nicest to use the router and navigate to e.g. path /AwesomeStuff/12345.
In your detail view, you'll have to create a handler that responds to something that happens in the master, e.g. navigation. You could do this by binding an event handler to the router in the detail view, e.g.:
this.getRouter().getRoute("AwesomeStuff").attachMatched(this.onRouteMatched, this);
In the implementation of the onRouteMatched handler, bind the detail view to the full set of record data by:
this.getView().bindElement({
path: this.getModel().createKey(
"/AwesomeStuff",
{ Id: oEvent.getParameter("arguments").Id })
}});
The bindElement method binds the (detail) view to a single OData element (not a list). If this element is cached in the ODataModel, it will be re-used. But if it's not in cache, a request is made to the server. Note that you can leave the select parameter away from this call, as you want the full set of data in your detail view, which is the default.
If you're looking for some code samples, generate a new project from the "SAP Fiori Master-Detail Application" template in SAP WebIDE.
I have multiple records which needs to be displayed as part of a search. A single result can contain multiple records associated to it. If there are multiple records I need to display the record with (+) and when clicked it further displays the list.
I would like to know what the best way is to implement ( I have checked Custom data grid ex: http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwCustomDataGrid but would like to use UI binder)
Once the user selects a record from the expanded list, how can we load that selected record?
Any pointer are appreciated..! ( Currently on GWT 2.2)
Widget list
Tree or maybe StackPanel seems like it would be useful here.
I´m using GWT 2.4 with a DataGrid and a SimplePager along with a MultiSelectionModel. I want to implement a simple select-all-feature over all pages.
I´m only able to select all visible items on the current page. What is the best way to select all items on all pages?
I know the MultiSelectionModel stores the proxy keys provided by a ProvidesKey object in a HashMap. I think I have to request all proxy objects from server or at least all keys. But actually I don´t want to store information about the ProvidesKey´s getKey()-method on server-side. But I also can not access the MultiSelectionModel´s HashMap of the selected proxies´ keys. This all looks cumbersome, so is there a better way to solve this?
As mentioned in https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCellWidgets#selection, one way to achieve this would be to implement your own SelectionModel (e.g. by extending AbstractSelectionModel or DefaultSelectionModel):
A complex implementation can handle "select all" across multiple pages using a boolean to indicate that everything is selected, and then keep track of negative selections.
Why do you need all keys for select all? When you select some objects from a list, you need to remember which ones are selected, but when you select all objects, you need a single Boolean:
// on click Select All button/checkbox
boolean selectAll = true;
// ask a user what he wants to do
// send a request to server with a parameter selectAll to update/delete all objects
Select all across multiple pages will work only if you are NOT lazy loading. First of all why do you need to select all? If you want to do some actions on all the grid data, you will already have the list and you can perform your actions on the list directly. Nonetheless you can select all the rows of the grid over multiple pages by iterating through the list and using the following API on each item.
public void setSelected(T item, boolean selected);
Note: This will work only if you are NOT lazy loading.
I have 2 select, I want the second select list loads based on selected value of first select. In another word first select is a list of objects, those objects each has a list of another objects. so I want load second list based on selected object of first select. I know that can be done using JQuery, but can I do this without JavaScript/JQuery?
Thanks in advance.
There is a tag that does this for you http://struts.apache.org/2.x/docs/doubleselect.html
Out of the box it probably uses Dojo API or uses a server side request to generate the second list. I have not used any of the JQuery UI in Struts.
No, you can't do this without Javascript. With static HTML you can't achieve this effect; drop-down fields on HTML forms come pre-loaded with their options, and are independent of other fields on the form.