Use of dtsb-inserted event

Use of dtsb-inserted event

roger.dtroger.dt Posts: 3Questions: 1Answers: 0

Description of problem:

Hi,

I'm trying to add EventListeners to the inputs of the search builder criteria and I came along that event but I don't get the place where to use it exactly. The docs say this:

The event is triggered on the original element(s) created in the init function to be used to retrieve the value from the user. This means that the best place to set listeners for this event is also in the init function by listening for dtsb-inserted.

Which init function is meant here? The example is not very helpful or clarifying as it only shows the init: declaration but no context.

I assume what might be referenced to is conditions[type][condition].init? As far as I understand I can use this to create a function for a [type] num and [condition] = for example. But I want it in general if [type] num is added. Is there a way to do this too?

cheers
roger

Answers

  • roger.dtroger.dt Posts: 3Questions: 1Answers: 0
    edited May 2022

    Alright. I found this example where it shows that my assumption was right. I would need to define the behaviour for every operator(?).

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    You are right I'm afraid. What's the use case - are you added your own listeners to the SearchBuilder elements as well?

    Allan

  • roger.dtroger.dt Posts: 3Questions: 1Answers: 0

    Hi allan,

    my use case is the following: I have a column with transfer data in bytes. That column is formatted on render to show KB/MB/GB numbers. To filter with the search builder the user has to enter something like > 1000000000 what is not very intuitive. To solve that problem I want to add a listener that shows the user the formatted string in context to the input field.

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    I see - thanks for the explanation. Yes, I'm afraid that would require a bit of customisation of SearchBuilder - there isn't anything out of the box that would do that.

    Allan

Sign In or Register to comment.