Giter VIP home page Giter VIP logo

Comments (18)

1rosehip avatar 1rosehip commented on September 25, 2024 1

Please check this: https://plnkr.co/edit/JnQrtBEHKo0hxPo3RbC0?p=preview

from jplist-es6.

1rosehip avatar 1rosehip commented on September 25, 2024

Regarding the search you have a deep linking option. If this options is enabled you may generate URL that filters a page on page load.

from jplist-es6.

flashmaster82 avatar flashmaster82 commented on September 25, 2024

Ok thanks! If you have some time could you please give some example how to do that for a newbie :)

from jplist-es6.

1rosehip avatar 1rosehip commented on September 25, 2024

data-id should be added to control this value is used in deep link URL. And deepLinking: true should be added in jplist.init:

<!-- textbox filter control -->
<input
     data-jplist-control="textbox-filter"
     data-group="group1"
     data-name="title-text-filter"
     data-path=".title"
     type="text"
     value=""
     placeholder="Filter by Title"
     data-id="title"
/>
jplist.init({
        deepLinking: true
});

from jplist-es6.

flashmaster82 avatar flashmaster82 commented on September 25, 2024

OK thanks, but how do i put this code on another page than the filter list and when i type in a word then it redirect to the filter list page and filter/search at that page? Like a site wide search function..

from jplist-es6.

1rosehip avatar 1rosehip commented on September 25, 2024

You may take deep link URL structure, for example in case on textbox control it could be: http://www.example.com/page#group=group1&title=a and on button click just change title=a to title=YOUR_KEYWORD

from jplist-es6.

flashmaster82 avatar flashmaster82 commented on September 25, 2024

This is my code i have on test.php (the filter list is on filterpage.php). I change title to * that will search/filter any keyword as in the docs. But how do i add a button etc. Sorry for being a newbie.

<input data-jplist-control="textbox-filter" data-group="group1" data-name="title-filter" data-path="*" type="text" value="" placeholder="Filter by Title" data-id="http://www.example.com/filterpage.php/page#group=group1&title=*">

from jplist-es6.

1rosehip avatar 1rosehip commented on September 25, 2024

Hello, where in the docs have you find that * will search any keyword? It looks like a docs mistake. Anyway, please use plunker to generate an example of your HTML files so I could help you. Plunker allows to generate a project with multiple files.

from jplist-es6.

flashmaster82 avatar flashmaster82 commented on September 25, 2024

I think that maybe overkill i just want a button for the input field to work. I have created a input button and it goes to the page but it wont filter anything when it goes to filterpage.php.

This is my code from subpage (test.php)

<input data-jplist-control="textbox-filter" data-group="group1" data-name="title-filter" data-path="title" type="text" value="" placeholder="Filter by Title" data-id="example.com/filterpage.php/page#group=group1&title=">

<input type="button" value="" data-group="group1" onclick="location.href='example.com/filterpage.php/page#group=group1&title=';"/>

I want to be able to search any keyword btw and also when i press "enter"

from jplist-es6.

1rosehip avatar 1rosehip commented on September 25, 2024

title= should contain the value of the input field, for example input=test.
Unfortunately I can't help you more than that without proper test case in plunker or other site like this.

from jplist-es6.

flashmaster82 avatar flashmaster82 commented on September 25, 2024

https://plnkr.co/UbjfNf3IYwznlufZPnn4

from jplist-es6.

flashmaster82 avatar flashmaster82 commented on September 25, 2024

You my friend are a genius!! That worked like a charm. If you ever come to Sweden i will buy you a round of drinks :) /Thank you so much for the help.

from jplist-es6.

flashmaster82 avatar flashmaster82 commented on September 25, 2024

Is it possible to also trigger the function with hitting the key "Enter" ?

from jplist-es6.

flashmaster82 avatar flashmaster82 commented on September 25, 2024

Ok i think i got it

<script>
	var input = document.getElementById("tb");
input.addEventListener("keyup", function(event) {
  event.preventDefault();
  if (event.keyCode === 13) {
    document.getElementById("btn").click();
  }
}); 	
  		var btn = document.getElementById('btn');
  		var tb = document.getElementById('tb');

	btn.addEventListener('click', function(){
  		  location.href='<?php echo $pages->get('/availableservices/')->url;?>#group=group1&title=' + tb.value;
  		}, false);
</script>

Do you think its ok?

from jplist-es6.

1rosehip avatar 1rosehip commented on September 25, 2024

You are welcome 👍
You are right, there are also examples on stack overflow: https://stackoverflow.com/questions/905222/enter-key-press-event-in-javascript

from jplist-es6.

flashmaster82 avatar flashmaster82 commented on September 25, 2024

Another question about the text-filter: in previous version i could type a value of 1 caracter/letter and it would filter now you have to type 2 letters?

from jplist-es6.

1rosehip avatar 1rosehip commented on September 25, 2024

The text filter hasn't change, 1 character is enough. Please check exmaples https://www.jplist.org/examples/cars

from jplist-es6.

1rosehip avatar 1rosehip commented on September 25, 2024

I'm closing this issue as it has too much stuff that is not related to autocomplete. The new autocomplete issue is here: #20

from jplist-es6.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.