NG Client Filtering

Forum to discuss the new web client version of Servoy.

NG Client Filtering

Postby Gordon McLean » Thu Jan 21, 2016 10:48 am

Hi
I am having a hard time understanding how, or in fact if, filters work with Servoy 8 NG Client. It would appear from the docs that there is a filter process however the example is at best confusing without more explanation.

ng-bind-html='model.myStringProperty | mnemonicletterFilter:model.mnemonicProp'

I have what I think is a very simple use case which is a series of tables, I want to apply a filter to these tables so that the user can find the relevant record. In AngularJS I would simply add something like

<p><input type="text" ng-model="test"></p>
<ul>
<li ng-repeat="x in names | filter : test">
{{ x }}
</li>
</ul>

In Servoy I was expecting to add an input in a similar way and filter the contents of the table based on the input.

Can I clarify is it possible to filter a table in a tab panel with a simple input and if so does anyone have a very simple example.

Cheers
Gordon :cry:
Gordon McLean
Clickdigital.com
Gordon McLean
 
Posts: 253
Joined: Wed Aug 03, 2005 12:24 pm
Location: UK

Re: NG Client Filtering

Postby jcompagner » Mon Feb 08, 2016 5:33 pm

the filter concept of ngclient is nothing more then just what angular gives us
We only provide a few and use a few of them

So you can write your own filter just fine
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: NG Client Filtering

Postby Gordon McLean » Mon Feb 08, 2016 5:45 pm

Yeh I got that, what I was hoping was that you could apply an angular filter to a Servoy table view as you can with Angular. The result was that I needed to build effectively a table component with filter and use that instead. It would be a brilliant addition to the current table format but I can imagine hard/impossible to produce.

Cheers
Gordon
Gordon McLean
Clickdigital.com
Gordon McLean
 
Posts: 253
Joined: Wed Aug 03, 2005 12:24 pm
Location: UK

Re: NG Client Filtering

Postby jcompagner » Tue Feb 09, 2016 6:11 pm

ah no that is not possible

then the component should have that configuration or something (the repeater of angular where you want to add that filter to is completely inside that component)

But doing filtering really on the client is not such a good idea anyway.
Because that would mean that all the data has to be loaded from the database to the application server to the browser and then you filter
You should do the filtering already directly on the database.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: NG Client Filtering

Postby Gordon McLean » Thu Feb 11, 2016 11:00 am

OK thats a pity...

So what we are saying is the Servoy interpretation of the Angular approach is to have the model stored on the server ? As surely native Angular would filter its own model which must by definition be the data currently on the client side.

As I understood it Servoy compliments the Angular approach so there is data on the client in the model and data on the server in a Servoy foundset with sockets between the two to keep them in sync.

The idea of the filtering as far as I understood was to filter whats available on the client, which in the case if a table view is what you can see. IF paging is enabled then it would filter the current page, if not then it would need to call the server, however either way a simple search/filter could be achieved.

Not sure if this could be built into a component easily but I sure can think of a lot of use cases.

Cheers
Gordon
Gordon McLean
Clickdigital.com
Gordon McLean
 
Posts: 253
Joined: Wed Aug 03, 2005 12:24 pm
Location: UK

Re: NG Client Filtering

Postby Andrei Costescu » Thu Feb 11, 2016 11:34 am

Foundsets are synced between the server and the client - and a part of the server foundset is available on the client as needed (depending on how much is scrolled in table-view). For sure angular filters could be implemented to filter client-side only data. I think Johan was trying to say that it wouldn't be nice to load a huge chunk of data (10000 records for example on the client) and filter on the client data. Lots of network traffic compared to actually filtering on the server and getting back a few rows potentially.

Default table-view implementation loads data as it needs to show it (so the client foundset data viewport can grow depending on the number or rows to be shown on the screen and scrolling + some other settings). A custom component that uses foundset property can load whatever it wants from the server's foundset and do whatever it wants with the data. Filter it / page it / scroll it / ...

Current default table-view doesn't have that kind of filtering implemented client-side (of course you can filter it server side). How do you envision it working client-side? You have for example 30 records visible area, 45 loaded and server-side foundset has 200+ records; then you filter client side records and it matches 5; but table-view can show 30 records. What happens then? Does it show only the 5 (would that really be useful) or does it start loading more and more from server in batches, then filters again until either it fills up visible area or all foundset contents are loaded in the client? Also how would that filter be specified? As a separate dataprovider shown in properties view or by a custom component that has the table (portal component) as a child component and can give it the filter directly on client? If we can make a nice spec, about how it should work we can see if it can really be included in the portal or it's cleaner to have a separate comp.

It sounds like maybe a server side filter (foundset find/search or load records) would be better here (for the general usecase).

Of course if you know you have a limited amount of records in your use-case or if you really want all the records in the foundset loaded on client, another custom component could load all and then apply a filter client-side.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 1018
Joined: Tue Jun 26, 2007 3:14 pm

Re: NG Client Filtering

Postby jcompagner » Thu Feb 11, 2016 11:41 am

filtering in my eyes only make sense if you have all the data.
And in servoy that is not directly the case (you can build a table component that does that quite easily, but not sure if that is such a good idea)

Even with paging (and you only have 1 page on the client as data)
How does then filtering work?
You just filter that small set that you "by accident/random" see?

For example the data in the db table has 1.000.000 rows of persons

You see only a page of 50 (which 50 i don't know, depending on your sort)

then you have a name filter column on top of it and you say "Gordon"
And you filter purely on the client side, what will that give you? Very likely completely an empty table...

Or should then the filtering keep asking the server for more and more data from the server until that page of 50 user is filled with only "Gordon"??
(but then that means that you really should do it directly on the server....)

By default everything is on the server, the client only views the part that it wants to show
For example a RecordView then really only the data of the selected record is there, you don't have the next or previous record as data, thats purely at the server in the foundset .

Tables (TableView/ListView/Portal) show a bit more but they show a "viewport" of what is in the foundset on the server.

That viewport can be a page (so 0-50, 50-100) or it can be endless scrolling an then the viewport will grow 0-50 > 0-100 or a special implementation that really only gets the page but knows how to render an empty div for the records above and below so the scrollbars work
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: NG Client Filtering

Postby jcompagner » Thu Feb 11, 2016 11:47 am

2 persons at the same time telling kind of the same story in different wording ;)
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: NG Client Filtering

Postby Gordon McLean » Thu Feb 11, 2016 11:54 am

Hi
Firstly I agree with Johan filtering 10000 rows would be at best slow and inefficient.

AND I am hearing the message from both of you @Johan :lol:

.... still want an awesome filter and think this would make a great feature for the Servoy NG Client !! - even if it is 100% impractical and impossible to produce ;)
Gordon McLean
Clickdigital.com
Gordon McLean
 
Posts: 253
Joined: Wed Aug 03, 2005 12:24 pm
Location: UK


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 7 guests