Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default Function Select #999

Open
RackweLLizm opened this issue Oct 28, 2023 · 2 comments
Open

Default Function Select #999

RackweLLizm opened this issue Oct 28, 2023 · 2 comments

Comments

@RackweLLizm
Copy link

RackweLLizm commented Oct 28, 2023

hello @ukrbublik thank you again for this beautiful project

I have more than one function When the user selects Func, "Select Function" input comes. Can I select a default function on this screen? I want "RELATIVE_DATETIME" to be selected by default.

I can also do it with source code intervention. I will be glad if you direct me

@ukrbublik
Copy link
Owner

In config.settings you can add:

    defaultField: {
      func: "RELATIVE_DATETIME",
      args: {
        date: {
          valueSrc: "func",
          value: {func: "NOW", args: []},
        },
        op: {
          valueSrc: "value",
          value: "plus",
        },
        val: {
          valueSrc: "value",
          value: 0,
        },
        dim: {
          valueSrc: "value",
          value: "day",
        },
      }
    },

But this will be the default LHS for every click on "Add rule".

If you want to have different default values for field and function (say field "Login" will be chosen as default if LHS is a field, and function "RELATIVE_DATETIME" will be chosen as default if a user clicks "Select source -> Function"), this is a different thing and not supported for now, needs additional chnages..

@RackweLLizm
Copy link
Author

Hello @ukrbublik

Yes, what I want is to work when the function is selected, it should not work when clicking on each rule add. Unfortunately, the defaultField feature is unusable for me.

I looked at FuncWidget.js and FuncSelect.js a bit and made some changes, when I set the setValue value as "RELATIVE_DATETIME" it was working but the "NOW" value was not coming automatically. If I do this operation with the mouse, it is called 2 times, the first time RELATIVE_DATETIME is loaded and the second time "NOW" is loaded. I could not manage to provide this.

If you direct me, maybe I can achieve this.

Thank you for your answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants