Welcome to the ASP.NET Core feedback portal. We’re happy you’re here! If you have feedback on how to improve the ASP.NET Core, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

When using setRules to load from JSON the rules display correctly but changing any value after will cause an error: Uncaught TypeError: 

Cannot read property 'operator' of undefined

in t.ruleValueUpdate (ej2.min.js:10)

I was able to reproduce this by adding a bit to the template sample: https://ej2.syncfusion.com/aspnetcore/QueryBuilder/Template#/material

I added the following code to JS:

var saved =

    "{\r\n    \"condition\": \"and\",\r\n    \"rules\": [\r\n        {\r\n            \"label\": \"Category\",\r\n            \"field\": \"Category\",\r\n            \"operator\": \"in\",\r\n            \"type\": \"string\",\r\n            \"value\": [\r\n                \"Clothing\",\r\n                \"Food\",\r\n                \"Travel\"\r\n            ]\r\n        },\r\n        {\r\n            \"condition\": \"or\",\r\n            \"rules\": [\r\n                {\r\n                    \"label\": \"TransactionType\",\r\n                    \"field\": \"TransactionType\",\r\n                    \"operator\": \"equal\",\r\n                    \"type\": \"string\",\r\n                    \"value\": \"Income\"\r\n                },\r\n                {\r\n                    \"label\": \"PaymentMode\",\r\n                    \"field\": \"PaymentMode\",\r\n                    \"operator\": \"equal\",\r\n                    \"type\": \"string\",\r\n                    \"value\": \"Cash\"\r\n                }\r\n            ]\r\n        },\r\n        {\r\n            \"label\": \"Amount\",\r\n            \"field\": \"Amount\",\r\n            \"operator\": \"equal\",\r\n            \"type\": \"number\",\r\n            \"value\": 10\r\n        }\r\n    ]\r\n}";



function loadClick() {

    var rules = JSON.parse(saved);

    qryBldrObj.setRules(rules);

}

The load event works initially, updating the rules. After trying to change the value of the paymentmode rule after this, the console error appears in the console and the SQL / JSON rule doesnt change in the preview on the right.

It seems to occasionally work, it's not consistent.

When I encounter this error in the application I am working on it breaks other code referencing the rules.


I attached the sample I created that experiences this error.