Hi,

I'm upgrading to tapestry:5.4.0 and tapestry-jquery:4.0.0.

I have the following .tml:

    <t:form>
        <t:datefield t:id="someDateField"
                t:value="someDate"
                t:mixins="jquery/CustomDatepicker"
                t:customdatepicker.params="params" />
    </t:form>

and in my java code:

    @Property
    private LocalDate someDate;

    public JSONObject getParams() {
        JSONObject params = new JSONObject();
        params.put("dateFormat", "dd-mm-yy");
        params.put("changeMonth", true);
        params.put("changeYear", true);
        return params;
    }

In the browsers console I do see the following:

Invoking tjq/customdatepicker({"selector":"#someDateField","params":{"dateFormat":"dd-mm-yy","changeMonth":true,"changeYear":true,"selector":"#someDateField"}})

But for some reason the parameters are not being applied to the component...


I have noticed that it does work when it is inside a Zone and when the Zone is rerendered, but cannot find out why...
Hope you guys can find the problem!


Example code you can test yourself:


/CustomDatePickerTest.tml/

<!DOCTYPE html>
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd <http://tapestry.apache.org/schema/tapestry_5_4.xsd>"
    xmlns:p="tapestry:parameter">

<t:zone t:id="zone" id="zone">
    <t:form>
        <t:datefield t:id="someDateField" t:value="someDate"
t:mixins="jquery/CustomDatepicker" t:customdatepicker.params="params" />
    </t:form>
</t:zone>

<t:eventlink t:async="true" t:event="rerender">Rerender</t:eventlink>

</html>


/CustomDatePicker.java/

public class CustomDatePickerTest {

    @Property
    private LocalDate someDate;
    @Inject
    private AjaxResponseRenderer ajax;
    @InjectComponent
    private Zone zone;

    public JSONObject getParams() {
        JSONObject params = new JSONObject();
        params.put("dateFormat", "dd-mm-yy");
        params.put("changeMonth", true);
        params.put("changeYear", true);
        return params;
    }

    void onRerender() {
        ajax.addRender(zone);
    }
}

Reply via email to