Skip to content

In layout.html if i change the layout from the drop down then also keyboard always remains the same. #323

@mithundebnath

Description

@mithundebnath

In layout.html if i change the layout from the drop down then also keyboard always remains the same. I already have included the required js file in the head section.
I need two languages hindi and bengali. So i Have written like this

var layouts = [
            // 'title , file name , layout name'
            "Hindi, hindi, hindi",
            "Bengali (qwerty-1), bengali, bengali-qwerty-1",
            "Bengali (qwerty-2), bengali, bengali-qwerty-2",
            ],

        t, o = '',

I have also included both .js files i.e. for hindi.js and bengali.js.
I can see the changes in "lang" dropdown So Its working till here. I can also see the change in $('h2').text(title) when i change in dropdown.But the keyboard doesnt change.
i have noticed the code in layouts.html is like this

$('#multi').keyboard({
            layout: 'qwerty',   // <---may be here is the problem
            stayOpen: true
        })
        // activate the typing extension
        .addTyping({
            showTyping: true,
            delay: 50
        });

        $('#lang')
        .html(o)
        .change(function(){
            var kb = $('#multi'),
                $this = $(this),
                $opt = $this.find('option:selected'),
                title = $opt.text(),
                layout = $this.val(),
                file = $opt.data('filename');
            $('h2').text(title);
            if (!$.keyboard.language.hasOwnProperty(file)) {
                $.getScript('layouts/' + file + '.js', function(){
                    showKb( layout );
                });
            } else {
                showKb( layout );
            }
        }).trigger('change');

I always get "qwerty" layout. But If i change manually i.e. like this

$('#multi').keyboard({
            layout: 'hindi' //...then I get get the hindi Layout.

Even i did try to do like this,

$('#multi').keyboard({
            layout: 'qwerty',  // <---may be here is the problem
            stayOpen: true
        })
        // activate the typing extension
        .addTyping({
            showTyping: true,
            delay: 50
        }); // this code i have written inside the  
$('#lang')
        .html(o)
        .change(function(){

....function and tried to change the "layout: 'qwerty' " statement with layout: $this.val() and
layout: title, In both the cases whatever in the first line of the dropdown is choosen by default,Then I change the dropdown it does not give any effect to the layout.
What should i write so that i can change the the layout dynamically with the change in the dropdown???

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions