Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.

1) Desktop v. Mobile #46

Open
ewebarchitecture opened this issue Oct 10, 2016 · 3 comments
Open

1) Desktop v. Mobile #46

ewebarchitecture opened this issue Oct 10, 2016 · 3 comments

Comments

@ewebarchitecture
Copy link

ewebarchitecture commented Oct 10, 2016

I've run into a problem with desktop v. mobile forms executing the way I've intended for them to be. Specifically, for the desktop version, everything functions properly; however, for the mobile version, results are displayed properly, but the onClick functionality doesn't work in that when a specific result is selected, nothing happens -- the result doesn't load in the text input box.

Specifically, I've got code something like this (at least while I'm troubleshooting):

...

<!-- Desktop -->
<div class="hidden-xs">
    <input type="text" name="model_number" id="ls_query" class="form-control mySearch" placeholder="Desktop world ...">
</div>

<!-- Mobile -->
<div class="visible-xs">
    <input type="text" name="model_number" id="ls_query_2" class="form-control mySearch" placeholder="Mobile world ...">
</div>

...

<script type="text/javascript" src="/AjaxLiveSearch/js/ajaxlivesearch.js"></script>

<script>
jQuery(document).ready(function(){
    jQuery(".mySearch").ajaxlivesearch({
        loaded_at: <?php echo time(); ?>,
        token: <?php echo "'" . $handler->getToken() . "'"; ?>,
        max_input: <?php echo Config::getConfig('maxInputLength'); ?>,
        onResultClick: function(e, data) {
            // get the index 0 (first column) value
            var selectedOne = jQuery(data.selected).find('td').eq('0').text();

            // set the input value
            jQuery('#ls_query').val(selectedOne);

            // hide the result
            jQuery("#ls_query").trigger('ajaxlivesearch:hide_result');
        },
        onResultEnter: function(e, data) {
            // do whatever you want
            // jQuery("#ls_query").trigger('ajaxlivesearch:search', {query: 'test'});
        },
        onAjaxComplete: function(e, data) {

        }
    });
})
</script>

Aside: The responsive functionality doesn't work out of the box, so I've resorted to using two different forms which result in two separate queries being executed so that I can have more information being displayed in the desktop version than is displayed in the mobile version.

Note: I'm also concerned about what's going to happen when two separate forms will need to be loaded on the same page.

I look forward to hearing from you with anticipation,
M

@iranianpep
Copy link
Owner

Hi,

I don't think it's a good idea to have two forms, one for desktop and one for mobile. Which mobile device and OS you have got the 'onClick' issue? I'll try to reproduce it.

Cheers,
Ehsan

@ewebarchitecture
Copy link
Author

The phenomenon occurs independent of device, operating system and/or browser, so take your pick. My client is using a recent iPhone, so that might be useful most for testing with them.

@iranianpep
Copy link
Owner

Thanks. I will test it and let you know.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants