NetTalk Central

Author Topic: Forms in disconnected/PWA app not working  (Read 6737 times)

jking

  • Sr. Member
  • ****
  • Posts: 397
    • View Profile
    • Email
Re: Forms in disconnected/PWA app not working
« Reply #15 on: January 18, 2019, 06:54:37 AM »
Bruce,

Thanks!  I have already "got my feet wet" with a JS filter on my two browses:

'return record.dts == 0 ? recordOk : recordFiltered'

This hides the deleted records from my browse.  So, with the expanded version of a filter you just detailed, I'll try to filter for specific items, such as Silver, etc.

I'll follow up as I progress with things.

Thanks again.

Jeff

jking

  • Sr. Member
  • ****
  • Posts: 397
    • View Profile
    • Email
Re: Forms in disconnected/PWA app not working
« Reply #16 on: January 18, 2019, 07:05:28 AM »
Don,

     Thanks for the follow up.  I'm determined to get this app working so I may be bothering you a bit (or a lot!), for your experiences and advice.  It definitely requires a change in the way I think about apps. 
     I have also begun looking at some of the NetTalk JavaScript code and I see JQuery in there.  So, I have dusted off my copy of JQuery, Novice to Ninja, from SitePoint.  Hopefully this will help.

Jeff

jking

  • Sr. Member
  • ****
  • Posts: 397
    • View Profile
    • Email
Re: Forms in disconnected/PWA app not working
« Reply #17 on: January 18, 2019, 06:38:42 PM »
Bruce,

     With your help on the filter code, I have made some really good progress today.  First, I created a new form, and placed a local variable called coinSearch at the top.  I then call the main BrowseCoinCollector procedure.  The end result looks like a browse with a locator above it.  See BeforeSearch.png.  I now can type a search term, such as "Cent", and the browse is filtered properly, as can be seen in AfterSearch.png.  Your filter code works great!

     I now have some items to work on:

1.  I need code to clear the coinSearch field, when I click the X button next to it.  I have tried a few things but could use some help with this.
2.  On this new form I have a tab, which contains the coinSearch field, a button and the Browse procedure.  I don't need a title in the tab, so removed it.  This results in a small blue rectangle at the top.  I suspect some CSS will address this.
3.  Deleted records still appear in my browse and I described this in my other thread about deleting records.  To fix this I would need to apply another filter to the browse:  'return record.dts == 0 ? recordOk : recordFiltered'.  I have not figured out how to combine filters yet.  This may not be necessary as you dig deeper into the deleted record issue as you mentioned in the other thread.
4.  Finally, I would like to search/filter over multiple fields.  Currently, the filter only looks at the Type field, which could be Dollar, Cent, Half Dollar, etc.  I would also like to search/filter over the Date field, eg. "1893 Dollar".  If this is to be done with a filter, things will get pretty complicated.  This goes back to item 3, about combining filters.  Any thoughts on how to handle this?  I'm thinking I may need a custom JS file with a filter function that I can call from the browse JS filter on the template.

Thanks,

Jeff
« Last Edit: January 19, 2019, 08:29:28 AM by jking »

jking

  • Sr. Member
  • ****
  • Posts: 397
    • View Profile
    • Email
Re: Forms in disconnected/PWA app not working
« Reply #18 on: January 19, 2019, 01:33:23 PM »
Bruce,

     Item 2 has been resolved.  I set the tab type of the form to none...easy!

     Item 1, I made some progress with.  I created a custom.js file and added it to my app.  I next created a function:
         
          function  clearSearch() {
           $('#coinSearch').val('');         
          }

     I call the function from the OnClick tab of the button, on the onClick: [JavaScript] field.  This clears the field as expected but the browse on this form is not refreshed, with the new filter applied.  How do I refresh or apply the filter again, after clearing the coinSearch variable?  Note, I have set the coinSearch and button Client-Side tabs to reset each other and the browse.

For items 3 and 4, I think I'll start new threads for these as this thread has become pretty long.

Thanks,

Jeff

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11171
    • View Profile
Re: Forms in disconnected/PWA app not working
« Reply #19 on: January 20, 2019, 10:57:00 PM »
>> How do I refresh or apply the filter again, after clearing the coinSearch variable?

You need to "post" a change event to the field so that the code "bound" to the field runs.
$('#coinSearch').change();

Cheers
Bruce

jking

  • Sr. Member
  • ****
  • Posts: 397
    • View Profile
    • Email
Re: Forms in disconnected/PWA app not working
« Reply #20 on: January 21, 2019, 09:13:16 AM »
Bruce,

     Thanks!  That worked perfectly.  I have attached an image (Browse.jpg) of my browse. 

I have two things left:

Where I have red lines, I want to add some space.  I think this is between each row.  I have looked at the elements of the page in DevTools but can't see how to adjust the CSS to put space here.  Can you suggest how to do this?

The next thing to do is to open the browse initially blank.  I then want to enter a search term and let the filter do it's thing.  I tried setting the search field to "*****' when the browse is first opened.  Since there is no entry like '*****', I thought that would force the browse to open empty.  Note, the option to hide the browse if blank on the template settings won't work here, since there is data in the browse tps file.  How can I accomplish this?

Jeff
« Last Edit: January 21, 2019, 01:17:21 PM by jking »

jking

  • Sr. Member
  • ****
  • Posts: 397
    • View Profile
    • Email
Re: Forms in disconnected/PWA app not working
« Reply #21 on: January 21, 2019, 05:27:42 PM »
Bruce,

     For spacing the cells/rows, I found the element in question and modified the css in my custom.css file.  I now have the spacing I wanted (see New_Browse.png).  Now on to getting the browse to open empty, waiting for a user to enter a search term.  Any and all hints, tips, suggestions accepted!

Thanks,

Jeff
« Last Edit: January 21, 2019, 08:24:08 PM by jking »