NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Rene Simons on September 28, 2019, 01:39:42 AM
-
Hi,
When building a browse for e.g. a phone app, the filtering is to be client side.
In the documentation an example shows a javascript statement like
'return record.paid ==1 ? recordOk : recordFiltered'
2 questions:
- Has this condition/statement to be quoted?
- Is it possible/allowed to call a javascript function here (with parms) which returns the recordOk or recordFiltered value?
Rene
-
Hello Rene,
Quoted in the JS itself? No.
I'm not a JS expert but I'm fairly sure you could call a function and get that return value.
Don
-
Hi Don,
Thanks for your reply.
ad 1: That would be nice in case you have a more complicated (but not too complicated) filter.
ad 2: I mean in the template field where the JS-filter must be typed in.
René
-
ad 2: I mean in the template field where the JS-filter must be typed in.
Yes sir. That needs to be in quotes.
-
Hi Rene,
yes, you can call a JavaScript function here. The function should return RecordOk or RecordFiltered.
here's an example from the CIDC training app;
function filterMessages(){
if ( (database.messages.record.fromuserguid == database.friends.record.friendguid) ||
(database.messages.record.touserguid == database.friends.record.friendguid) ){
return recordOk
} else {
return recordFiltered
}
};
Cheers
Bruce
-
Bruce,
Nice! Thank you.
René