NetTalk Central

Author Topic: Custom JavaScript functions  (Read 2629 times)

jking

  • Sr. Member
  • ****
  • Posts: 400
    • View Profile
    • Email
Custom JavaScript functions
« on: January 24, 2019, 05:50:00 PM »
Bruce,

I have the filter you helped me construct, on the JS filter line of my browse:

'return record.type.toLowerCase().indexOf($("#coinSearch").val().toLowerCase()) >= 0 ? recordOk : recordFiltered;'

I want to expand on this browse so I tried putting it into my custom.js file, and calling it from there.  I get errors, see attached image.  The changes I want to make are to filter over more than one field.  For example, filter over Type and Date.  This filter will become larger and more dificult to handle on the template JS Filter entry.  Thus, I want to add it to the custom.js file.  I have tried numerous modifications but keep getting the function error.  Can you help?

Thanks,

Jeff

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11181
    • View Profile
Re: Custom JavaScript functions
« Reply #1 on: January 28, 2019, 12:08:35 AM »
my guess is that record is not in scope here. so pass it as a parameter;

filterCoinBrowse(record)

and then prototype it as

function filterCoinBrowse(record)

cheers
Bruce