Count of the icon tab filter - count

I would really like to understand how to use the "count" property of the IconTabFilter for SAPUI5 to dynamically show the count of the result set of a table.
I have the following code -
<IconTabFilter
count="{DataSet/$count}">
<Table items="{DataSet}">
But the count is not filled automatically.
I am using an oData model that is bound on the view level. I do not want to make another backend request just for the counts. What am I doing wrong here? Is there a different mechanism that can be used?
I also tried using the updateFinished event on the table to then get the count and set it via JS but the event is triggered only on DOM placement of the table. In my case the table is hidden behind the IconTab and is not placed into the DOM till the first time the user clicks the tab so its useless.
Really would appreciate some insight into how to use this!
Thanks!

Okay, so what I did was I bound my information to a local model and did an oData $expand query to fetch the entire pages information in one call.
This worked out for me because I had several sets of data to be fetched. Before they were bound individually to tables, now they are all in one query.
In the .done() method of the call I just used the setCount method of the IconTabFilter to set the count as per the return data set.

Related

In App Maker, can you fake valueIsRecord with a dropdown field?

In App Maker, what is the simplest way to achieve the same result with a dropdown box that you can with a suggest box, which can return the whole record when you make a selection giving you the ability to assign associated record values to other fields on the page?
Consider a data model with three fields, (Code, Description, and Severity). Add a dropdown box to select the Code. Have the selection, (probably using onValueChange or onValueEdit), write the selected Code's Description to a label field beside the dropdown box. The Code's Severity will also be used to affect the style in some way like background color or something, but for this answer, merely assigning the value to a scripting variable will be good enough. It's the record value access and assignment mechanism I am after.
Clarification: This data model will not be the page's datasource. It is a secondary reference table used for assigning a code to a ticket. You can also assume that a record value will be written to a field in the page's datasource as well.
I would appreciate the simplest low code solution as we will have non-programmers attempting this. Thanks.
As long as you leave your value binding on the dropdown blank the following should work:
Set the options binding to:
#datasources.YourDatasource.items
You may want to consider changing the 'Names' binding to be the projection of a particular field in this datasource otherwise the values showing in your dropdown will only be the 'keys' from this datasource.
Then in your onValueEdit event you will gain access to individual fields like this:
var item = widget.datasource.item;
item.YourFieldToEdit1 = newValue.YourOtherDatasourceField1;
item.YourFieldToEdit2 = newValue.YourOtherDatasourceField2;
That would probably be the simplest way.

Kendo Grid: Prevent datasource refreshing on grid filtering

I got a grid displaying +- 4000 candidates. You can search and filter the grid by typing in a textbox. For each character typed there is a 1.5 second debounce before the grid refreshes/filters with the textbox content as a parameter.
On my local database this works like a charm. But on the live environment there is a big performance issue.
Each time the filter is applied, the Read action is called, all data is fetched and filtered. This means a new request to the server for every character typed.
What I want to achieve is that when filtering, the filtering happens on the data inside the grid, instead of refreshing/reloading the whole datasource on every filter.
How can this be achieved?
This can be simply achieved by setting serverFiltering in DataSource to false.
API Reference

SmartGWT ListGrid FilterEditor getValue

I have a little appliation that shows MySQL data in web browser ListGrid. It has 14 columns.
I would like to upgrade it so the user could add query parameters.
For this job the best I could imagine is the grid.setShowFilterEditor() that put text boxes above the column headers and will live together with the column header when moved or resized.
I planned to use the filter button FilterEditorSubmitHandler() to get the filter values and run the query.
Unfortunately, I can not find any solution to get the text from a certain filter box eg. the value that was written by the user into the box above Column_#1. Is there any way to do that or this FilterEditor grown together with the DataSources object, and not available for any other data binding?
Something like this, but without using DataSource:
http://www.smartclient.com/smartgwt/showcase/#grid_sortfilter_disable_filter
As per my knowledge, filter editor works on com.smartgwt.client.data.DataSource only.
If you want to have filterEditor in ListGrid, you have to use DataSource or go for some custom implementation.

Keep selection when refreshing datagrid in ActionScript

I'm working on my first ever AIR application with flashbuilder - just so you know.
I've bound a mx:DataGrid component to a DataProvider which is a mx:HTTPService fetching an xml file with items. To keep the data up to data I'm polling the webservice on a given interval.
My problem is that I loose the currently selected item in my DataGrid when the data is updated. I've tried to save the DataGrid.selectedIndex and set when the data is updated, but I'm not sure when to do it?! The closest I've come is to restore the index when the updateComplete event of DataGrid is fired. This works, but the selection first fades away and then fades in - not updated soon enough.
So what is the best way to keep the selection? (only one selected item at a time)
And as a side question: is there a convenient way to only update the data when it has actually changed?
Thankful for any suggestions!
I'll start from the bottom, the only way to only update the data when it has changed is to pass a check on the data on the server side to see if data has changed and make that a call before the actual update. So in short, you make two calls, one to see if the data has changed, which is a server side query, and the next only if that returns true, which updates the data.
Alternatively, you can also get the update, and compare it to your current data, and only update the UI if that data is different, but I have a feeling you mean the former answer of only doing the update CALL at all, if the data has changed.
As for the other solution, after you've saved the selectedIndex, do this inside your updateComplete:
private function yourDataGridUpdateComplete(event:FlexEvent):void{
yourDataGrid.selectedIndex = yourIndex;
yourDataGrid.validateNow();
yourDataGrid.scrollToIndex(yourIndex);
}
The DG uses the UUID of the data items to determine whether the item should be still selected after a refresh. If the data items don't implement IUID they basically get random values created each time they are added to the DG.
If your data items implement the IUID and you use a consistent value (DB sequence number for example) the DG will "know" that after a refresh, the data item is the same one as before.

Two tables on one page Asp.Net

My project is in Asp.Net Webforms using C#.
On one of my web pages, I want to have two tables. One is going to be a summary table and the other a more detailed breakdown of the summary. When the user clicks on one of the rows of the summary table, I want the corresponding breakdown rows to appear in the breakdown table.
These tables can have anything between 60 and about 500 rows.
I have thought of two possible ways of doing this and I'm not sure which is best, or if there is another, better way of implementing this:
1) When a user clicks on one of the rows in the first table, a postback event happens, and the data for the second table is loaded from the code behind.
2) When the webpage is loaded for the first time, both tables are filled with all of the possible data, but all of the rows in the second table have the "display: none;" CSS attribute. When a user clicks on a summary row, the CSS of the corresponding breakdown rows is changed using JavaScript.
I'd go with your first thought and perhaps either
load the data for the second table through an AJAX request returning only row data in JSON (or maybe even the HTML for the table)
use an UpdatePanel
if the user only needs to view the data, I would go for the former, but if they need to edit the data in some way, I would probably choose the latter (even though I'm aware that UpdatePanels are effectively a full postback in async clothing, I feel their use can make the UI more fluid).
You could also make an AJAX call when the user clicks on a row in the summary table to return the data for the 2nd table.
second way no way, loading all of data and then hiding showing is not a good idea, it will be slow and if you add more functionality it will only get in your way...
I recommend this two approaches:
1)first table with pagination
click on row triggers ajax call to page method
page method return second table
here, you can see how to that:
http://encosia.com/2008/02/05/boost-aspnet-performance-with-deferred-content-loading/
2)using of uframe
http://labs.omaralzabir.com/UFrame2005/
cheers

Resources