Git Product home page Git Product logo

Comments (4)

Tarmil avatar Tarmil commented on September 22, 2024

That is indeed not possible right now. But it would be fairly easy to add this capability.

from bolero.

kgday avatar kgday commented on September 22, 2024

Thanks Tamil,
I just needed to focus an element so did that by tagging the id and using jsinterop to find the item by id and focus. However I probably could return the reference from the javascript if I needed more.

For anyone else's benefit who needs to do something similar:

In my index.js

window.utilFuncs =
{
    focusElementByID: function (id) {
        const myElement = document.getElementById(id)
        myElement.focus();
    }
}

I called that then with

    
    let focusJobIDSelection (jobID: int64) =
        let checkBoxID jobID = $"SelectionCheck%d{jobID}"
        task {
            let elementID = checkBoxID jobID

            return!
                (jSRuntime.InvokeVoidAsync("utilFuncs.focusElementByID", elementID))
                    .AsTask()
        }
        |> Async.AwaitTask

from bolero.

Martin521 avatar Martin521 commented on September 22, 2024

I just use
let focusElement (id:string) = this.JSRuntime.InvokeVoidAsync("focusElement", id) |> ignore.
Why should I wait for it to complete?

from bolero.

Tarmil avatar Tarmil commented on September 22, 2024

This is fixed in version 0.22. An attribute ref="${MyRef}" will give you a method .MyRef() that takes an HtmlRef as argument. https://fsbolero.io/blog/20230410-bolero-0-22-released

from bolero.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.