Oct 14, 2011 at 12:21 PM

Colleagues! jQXB reacts (binds element's value into datasource) on event "Change". In our case, this event occurs too early, so we are generating our own event and want to get bind in response to it. Designed for this attribute jqxb-changeonevent, which we found was inoperable. Are there such a possibility in the foreseeable future? 

Oct 14, 2011 at 2:15 PM

Hello Andrew,

Why don't you get jqxb-changeonevent working?  Below is the working example where datasource is refreshed after select event occurs on the first textbox. Is it what you need?




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <title>jQXB unit tests</title>
    <script  src="Scripts/jquery-1.6.3.js" type="text/javascript"></script>
     <script src="Scripts/jQXB.1.1.js" type="text/javascript"></script>    
     <script type="text/javascript">
       var header = "<h2>jQXB Unit Test</h2>"; 
        var Person3 = { 'Name': 'Andrew',
            'Surname': 'McDowell',
            'Address': { 'Street': 'Wall Street', 'ZipCode': 'XYZ123', 'Phones': [{ 'prefix': '0342', 'number': 1234567 }, { 'prefix': '0456', 'number': 21341234 }, { 'prefix': '050', 'number': 37802345}] },
            'MonthlyAmount': [345, 457734.54, 40, 4345, 45643, 34565, 97685, 95685.95, 467856, 5674, 56785, 346, 344565]


        $(function () {

                jQXB.setDataSource("Source", Person3,true).doBind("Source");
                jQXB.attachChangeEvent("Source", null, "Address.Phones.0.prefix", $("#selectText"));


<!-- Binding area -->
  <legend><h3>Binding operations</h3></legend>
                <span>Type something here and select the text :</span>  <input id="selectText" type="text"  jqxb-datasource="Source" jqxb-datamember="Address.Phones.0.prefix" jqxb-changeonevent='select'/>
                   <br />
                  <span>See the datasource was refreshed after the select event in the first textbox :</span> <input id="Text1" type="text"  jqxb-datasource="Source" jqxb-datamember="Address.Phones.0.prefix" />

Oct 17, 2011 at 5:36 AM

Thanks a lot, Anatolii! We (me and my colleagues) have got it!

We assumed that only one  jqxb-changeonevent attribute is enough. But it's not! Is it a bug or what?

How did you hear about the magic method 
jQXB.attachChangeEvent - we do not see it in the documentation?
Now we must to invoke this method every time ?

Oct 17, 2011 at 7:42 AM

Hello Andrew ,

For now jQXB is constructed in such way that only default 'change' event is automatically bound with control .  To bind non-default event you  should separatly invoke attachChangeEvent for every html control you need.

As for me it's really looks like a bug and invoking attachChangeEvent is only a workaround. 

Waiting for comments from ligthcode about that issue.