hi,
I'm having an issue with the autocomplete & queryBuilder components.
I'm using a UrlAdaptor, a custom itemTemplate and an e-autocomplete-filds to search by a particular field.
the select event calls:
<ejs-autocomplete id="autoCompleteWhereConditions"
itemTemplate="@Html.Raw("<div><div class=''> ${name} </div><div class='font-weight-light text-muted text-monospace'> ${sqlRule} </div></div>")"
select="loadRule" >
<e-data-manager url="@Url.Action("GetPreviousQueryConditions")" adaptor="UrlAdaptor"></e-data-manager>
<e-autocomplete-fields value="name"></e-autocomplete-fields>
</ejs-autocomplete>
function loadRule(args) {
var querybuilderObj = getMyQueryBuilderInstance();
querybuilderObj.setRules(args.itemData.rule);
}
function getMyQueryBuilderInstance() {
return ej.base.getInstance(document.getElementById("myQuerybuilder"), ej.querybuilder.QueryBuilder);
}
The queryBuilder loads the new rule, and displays it automatically.
The rule it's a value in the autocomplete item, and it has this structure:
public class Rule
{
public string Condition { get; set; }
public string Label { get; set; }
public string Field { get; set; }
public string Operator { get; set; }
public string Type { get; set; }
public string Value { get; set; }
public List<Rule> Rules { get; set; }
}
So you know.. the rule is a "group" (as the base rule) with and operator value (and/or) or its a conditions with the other field filled with values..
This works great, with no problem at all.... when I CLICK on the autocomplete item.
But if I select the item pressing ENTER something strange happens.
(the base object contains {operation:"and" and rules:[]})
If the rules array contains only one condition.. the querybuilder loads nothing..
If the rules array contains 2 conditions (in the same base group.. and even if theres more groups).. the first rule doesnt get loaded..
So, the problem is that is getting rid of the first rules array element
Any clue?
Could be something related to an async logic? because, if I debug and go step by step, I dont get this error.
Thanks in advance.