question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Search request data

See original GitHub issue

Hi,

I have a grid with a toolbar, in which I do not load any data when it is initialised. I overload the onSearch method like this to load data from an url which works fine:

onSearch: function (event, eventData) { w2ui['search'].clear(); w2ui['search'].load('http://127.0.0.1:5000/search/' + eventData.searchValue); }

The parameters requested are: "GET /search/opensuse?cmd=get-records&limit=100&offset=0&sort[0][field]=star_count&sort[0][direction]=desc HTTP/1.1"

I also overload the onReload method like this: onReload: function (event) { this.toolbar.disable('pull'); var search_value = w2ui['search'].searchData[0].value; w2ui['search'].clear(); w2ui['search'].load('http://127.0.0.1:5000/search/' + search_value); }

But when I retype a search term, or refresh or even clear the search field I get more request parameters like "GET /docker/search/opens?cmd=get-records&limit=100&offset=0&search[0][field]=name&search[0][type]=text&search[0][operator]=contains&search[0][value]=opensuse&searchLogic=OR&sort[0][field]=star_count&sort[0][direction]=desc HTTP/1.1"

I do not get search[0][value] on my first search or after I clear the search field. Is this because the grid is empty, so there is nothing to search for?

But why is a request sent when I clear the search field? Is it necessary ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mpf82commented, Jul 6, 2016

No, you only get one parameter event (this is the same in 1.4 and 1.5) (x). In 1.5 the event data has a property reset and you would write:

onSearch: function (event) { if (event.reset === true) { return; } /* your other code here */ }

In 1.4 there is no reset property, so you have to check the searchData property:

onSearch: function (event) { if (jQuery.isEmptyObject(event.searchData)) { return; } /* your other code here */ }

Optionally, you can also call event.preventDefault() and/or event.stopPropagation() before you call return; if you want to prevent w2ui from executing the default behaviour.

(x) = Well, for backwards compatibility, events do support 2 parameters ( eventData.target, eventData ), but internally it’s really just 1 event parameter object, that’s why I suggest to implement events only with 1 parameter.

0reactions
anselalcommented, Nov 23, 2016

Sure !!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Search: list | YouTube Data API - Google Developers
Returns a collection of search results that match the query parameters specified in the API request. By default, a search result set identifies...
Read more >
Remove your personal information from Google
Important: Google Search shows information gathered from websites across the web. Even if we remove content from Google Search, it may still exist...
Read more >
3 ways to use search query data from Google Search Console
3 ways to use search query data from Google Search Console. New to Google Search Console? Columnist Dianna Huff provides a handy guide...
Read more >
Google Trends
Enter a search term or a topic. search. Or start with an example. keyboard_arrow_down ... Explore how Google data can be used to...
Read more >
ResDAC: Find, Request and Use CMS Data
Find, Request and Use CMS Data ... How to request identifiable data ... These files were created from data submitted to CMS by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found