We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I create a empty field like "placeholder"?

Thread ID:

Created:

Updated:

Platform:

Replies:

145323 Jun 17,2019 07:28 PM UTC Jun 24,2019 10:17 AM UTC JavaScript - EJ 2 3
loading
Tags: Query Builder
Lucas
Asked On June 17, 2019 07:28 PM UTC

Hi, how can I set by default an empty field to my Query Builder like a placeholder (empty data)?

And how can I show the "+" button when my data is empty?


Thanks.

Vinoth Kumar Sundara Moorthy [Syncfusion]
Replied On June 18, 2019 10:50 AM UTC

Hi Lucas, 
 
Thank you for contacting syncfusion support. 
 
#1: how can I set by default an empty field to my Query Builder like a placeholder (empty data)? 
We have checked your requirement and we suspect that you need to display the place holder value for DropDownList at initial rendering. And we would like to let you know that, if you haven’t referred the rule property, so the QueryBuilder renders as like in your provided screenshot. For your convenience, we have prepared the below sample based on your requirement. 
 
 
Could you please check the above sample and get back to us with more details, if we misunderstood your requirement? 
 
#2: how can I show the "+" button when my data is empty? 
Before we provide solution for this, we would like to know your exact use case requirement about “adding ‘+’ button when data is empty”. Could you please let us know where you want to add plus button and when it should be added? 
 
Regards, 
Vinoth Kumar S 


Lucas
Replied On June 21, 2019 11:36 AM UTC

Hi, thanks for reply. I found the problem: when I use the method reset(), my query builder don't show the default empty field that I want, instead just show the buttons (AND, OR and Plus).



My code works like this:

I have a tree view, and when I select a node the query builder changes using the dataSource inside the selected node.
To refresh the query builder, I have two conditions:

if selectedNode contains defined rules (is not empty) 
    builder.setRules(selectedNode.rules);
else  // could be null, empty object {}, undefined
   builder.reset();

Is the reset() the right method to my situation?

Thanks.


Vinoth Kumar Sundara Moorthy [Syncfusion]
Replied On June 24, 2019 10:17 AM UTC

Hi Lucas, 
 
Good day to you. 
 
Yes, you can use the reset() method to achieve your requirement. For your convenience, we have prepared sample for your requirement and same can be found in below link, 
 
 
Could you please check the above sample and get back to us if we misunderstood your requirement or you need any further assistance on this? 
 
Regards, 
Vinoth Kumar S 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon