Receiving an error message stating "Unable to execute method 'toLowerCase' on an undefined object" while attempting to use grid.setFilter(...)

I am trying to programmatically set my filter plugin for an enhanced grid. Here is the approach I am taking:

//concat query string
console.log(queryString);
grid.setFilter(queryString, 'logicany');

However, I am encountering an error:

Uncaught TypeError: Cannot call method 'toLowerCase' of undefined FilterDefDialog.js.uncompressed.js:949

When I look at the console log for the query string, it appears as:

[{type:'string',column:1,condition:'contains',value:'test'},{type:'string',column:1,condition:'contains',value:'13'}]

Interestingly, when I manually set a hardcoded query string like this:

grid.setFilter([{type:'string',column:1,condition:'contains',value:'test'},{type:'string',column:1,condition:'contains',value:'13'}], 'logicany');

it works perfectly fine. Can anyone help me identify what might be wrong with my initial approach?

Answer №1

One approach is to convert the String into a JSON Object and then pass it. In case jQuery is in use, consider utilizing parseJSON.

var jsonQueryString = $.parseJSON(queryString);

grid.updateFilter(jsonQueryString , 'logicany');

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for detecting when the scrollbar disappears during a webpage load in Selenium

Encountering a problem with the page loader during the automation of a web application. The scrolling bar is clicking on all Web elements while each page loads. How can I wait until the scrolling bar disappears? Your suggestions are appreciated. https:// ...

Experiencing an "Unsupported media type-415" error when making an ajax call using Jquery and ajax technology

When I try to update a specific record using an ajax function, I keep receiving a 415-Unsupported Media type error. Below is the JavaScript code I am using: $("#update").on("click", function(){ event.preventDefault(); return $.ajax('/upda ...

Setting a cookie in a browser using an AJAX response: A step-by-step guide

When utilizing a Javascript function with jQuery to send a POST request to a web service, the response from the web server includes a header "Set-Cookie: name=value; domain=api.mydomain.com; path=/", along with a JSON body. However, despite this expected ...

Create a duplicate of a div using JavaScript and modify the IDs of the inner elements within

I have two static div tags with a select tag and a text box inside, each with different IDs. When I clone the tag, it duplicates the same div tag in the DOM. How can I change the inner elements' tags? Below is the code snippet: <div id="m ...

What is the reason for converting arrays to strings when making requests, but not objects?

Yesterday evening, while using AJAX to send data to my server through $.post, I encountered a problem where JavaScript Arrays had to be "stringified" and added as a field to an object before being transmitted. Here's what the code looked like: $.post ...

Unable to instantiate a class using a module in React

I am on a mission to combine Monaco editor and Convergence in order to create a collaborative editor. To achieve this goal, I am referencing the following repositories and examples: https://github.com/convergencelabs/monaco-collab-ext https://github.com/c ...

How come all the toggle switches are operating simultaneously?

** I have encountered an issue with storing toggle switch values in local storage. When I try to turn one toggle switch "ON", all the toggle switches turn "ON" simultaneously. This problem arises after using checked={value} in the tag. Can someone ple ...

The CSS ::after selector is experiencing a decrease in animation speed

There is a dropdown menu set to fade in once a link is clicked. Everything works well, the menu fades in properly. However, when clicking off and triggering a function that fades out the dropdown, the triangle on top of the box fades out slightly slower th ...

I'm puzzled about what could be behind this error message Error [ERR_HTTP_HEADERS_SENT], especially since I've only sent the response header once. How can I figure out the cause

Here is a snippet of code from my routes file: router.get('/api/', async function(request, response){ let entries = await Entries.find({}, function(error){ if(error) console.log(error); }); let catArray = []; entrie ...

Validating Django forms using cleaned_data with the help of AJAX

I am facing a critical issue where I need to retrieve values from a form using both the cleaned_data method and the getlist method due to receiving data via ajax. Unfortunately, my attempts have been unsuccessful, leading to an error message in my termina ...

Unable to access this context in Firefox debugger after promise is returned

I'm curious as to why the 'this' object is not showing up in the debugger in Firefox, but it does appear in Chrome's debugger. When I try to access 'this.myProperty', it shows as undefined. This is the code from my TypeScript ...

What is the best way to utilize the node.js module passport-google?

I'm currently working on a node.js web application that prompts users to sign in using their Gmail account. While following instructions provided at this website, I modified the URL from www.example.com to localhost and launched the application. Howev ...

A method for conditionally looping to match header rows with data rows in a map

When dealing with two types of rows: header rows and data rows, each consisting of 18 columns. The number of data rows is determined by the number of header rows, for example: If there are 2 header rows, there should be (2 data rows: first one maps to th ...

How can I use the same popup button to open a different link in a new tab?

I have a situation where I am using a button to trigger an ajax html popup. What I want is for the same button, when clicked, to open another page in a new tab. Any assistance would be greatly appreciated. Below is the HTML code I am currently using: < ...

Using an array of references in React

I've encountered a problem where I'm trying to create a ref array from one component and then pass it to another inner component. However, simply passing them as props to the inner component doesn't work as it returns null. I attempted to fo ...

Enhance your webpage with dynamic styling using third-party CSS animation

Apologies for any similarity to other questions on this topic. I have searched extensively, but any assistance would be greatly appreciated. I am utilizing a new animation library from Animista to animate specific elements on a test website. Animating ele ...

Display real-time export status improvement

Utilizing the Java Script below to display a loader once the Export To Excel button is clicked. <script type="text/javascript"> function showProgress() { var updateProgress = $get("<%= UpdateProgress1.ClientID %>"); updateP ...

What is the best way to search for specific values within a complex nested JSON array in Postresql?

In my Posgresql database, I have a column containing json objects (jsonb type) structured like this: [ {"qos1": [ { "country_id" : [{"id":"IT",...}, {"id":"FR",...},...] },...],... ...

Issue with EnumDeserializer in jackson-mapper 1.9.12 version

I'm currently working on a scenario where I need to map a String to an enum Object using the Jackson ObjectMapper.readValue(String,Class) API. The issue arises when my JSON string contains a Task Object with an Action enum defined as follows: public ...

invisible recaptcha with synchronous ajax

Hey, I'm trying to figure out a solution on how to obtain the token or a valid response from Recaptcha and then proceed with running the ajax call. Does anyone have any suggestions on how to achieve this in a synchronous manner? Here's the proce ...