开发者

smartgwt calendar

开发者 https://www.devze.com 2023-02-05 21:22 出处:网络
I\'m trying to populate a smartgwt calendar using data form a server obtained using a datasource. Unfortunately the examples in showcase only use client only test data, where one has to create an arra

I'm trying to populate a smartgwt calendar using data form a server obtained using a datasource. Unfortunately the examples in showcase only use client only test data, where one has to create an array of calendar events first. Can anyone give an example of 开发者_如何学编程how to do this directly from a rest datastore for example.

Thanks.


Yes, I had trouble tracking down an example too. I eventually figured it out by looking at the samples. It seems like the Calendar doesn't care about the type of the objects used by the datasource, but rather that they provide properties of name, startDate, endDate, and description. (Note that startDate and endDate should be defined as "datetime" in your ds.xml, or all of the events will be full-day events.) Here an example ds.xml (based on the sample for Google App Engine modified with a calendar object):

<DataSource
    ID="Appointment_DataSource"
    serverConstructor="com.isomorphic.jpa.GAEJPADataSource"
    beanClassName="com.smartgwt.sample.server.Appointment"
    >
    <fields>
        <field name="eventID"    type="text" hidden="true"   primaryKey="true" />
        <field name="name"       type="text" title="Name"        required="true"   />
        <field name="startDate"  type="datetime" title="Start Date"  required="true" />
        <field name="endDate"    type="datetime" title="End Date"    required="true" />
        <field name="description" type="text" title="Description"  />
    </fields>
</DataSource>
0

精彩评论

暂无评论...
验证码 换一张
取 消