Workaround for JS .bind in Java was: problem with add value in dukescript

9 views
Skip to first unread message

Jaroslav Tulach

unread,
May 26, 2016, 2:27:34 AM5/26/16
to Fanny Lau, DukeScript
Hi.
I don't think anyone really tested ".bind" - it may work, but it may be easier for you to avoid it. The known to work way is:

2016-05-24 9:27 GMT+02:00 <lauwaif...@gmail.com>:
inside index.html

<button data-bind='click: addfilename.bind($data, "temp")'>testing</button>

<button data-bind='click: addfilenametemp'>testing</button>
 

inside DataModel.java

@Function public static void addfilename(Data model, String temp) {   
       model.setMessage(temp);
}

@Function static void addfilenametemp(Data model) {
  addfilename(model, "temp");
 }

Regards.
-jt

 

it show null value in message after pressing the 'testing' button


I use netbeans IDE to write this code....

help please

--
You received this message because you are subscribed to the Google Groups "DukeScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dukescript+...@googlegroups.com.
Visit this group at https://groups.google.com/group/dukescript.
To view this discussion on the web visit https://groups.google.com/d/msgid/dukescript/e201ce95-1a20-432e-bf72-5eecf0017a1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jaroslav Tulach

unread,
May 26, 2016, 4:04:30 AM5/26/16
to Fanny Lau, DukeScript

2016-05-26 9:44 GMT+02:00 Fanny Lau <lauwaif...@gmail.com>:

I want to add name dynamic, just use "temp" for testing. Could you mind to get me some suggestions. I try to put some dynamic value from html to duke script code. Thx thx

lauwaif...@gmail.com

unread,
May 27, 2016, 12:31:37 AM5/27/16
to DukeScript, lauwaif...@gmail.com
  //@Function static void testingfilenames(Data model,final String model1) {
    @Function
    public static void addfilenames(Data model, String temp) {
        //model.setMessage(model.getMyMessage());
        Dialogs.confirmByUser(temp, new Runnable() {
            @Override
            public void run() {
            }
        });
}

<select data-bind="options:item2, selectedOptions:selectedItems, click:$root.addfilenames, text:selectedItems)"></select>
or
<select data-bind="options:item2, selectedOptions:selectedItems, click:$root.addfilenames)"></select>


also not work, just return null >,<
 
Reply all
Reply to author
Forward
0 new messages