PDA

View Full Version : Date format in gridtext widget


Frankhil
12-15-2008, 07:23 AM
Guys;

I am working with datasets provided by the web server that have nodes in with dates in the following format (e.g. for today).

2008-12-15

In a gridtext widget in a data grid bound to this node in the dataset I would like to display dates in the format "12/15/2008".

Would anybody know of an easy way how to do this.
(prerably without changing the nodes in the dataset because after manipulation I am posting the dataset back to the server which expects 2008-12-15)

rcyeager
12-15-2008, 07:36 AM
I use ondata handlers to manipulate bound data.

Frankhil
12-15-2008, 05:49 PM
I tried this trigger but it does not fire.

<gridtext width="100" datapath="NextFollowUpDt/text()" editable="false">Next!Follow-up
<handler name="ondata">
Debug.write("ondata=" + this.value);
</handler>
</gridtext>

When is the ondata trigger supposed to fire.
On the doRequest() or when data is bound to every individual cell in the grid?

rcyeager
12-15-2008, 07:35 PM
You will want the ondata handler on cells. It may require using a delegate.

If you post a complete test program, I'll take a look.

Robert Yeager
http://www.qrowd.com
http://www.cooqy.com

Frankhil
12-18-2008, 08:18 AM
Here is the sample code followed by some sample XML dataset records that I am working with.
I really appreciate your help with this.

<canvas debug="true">
<dataset name="dsXoNavigator" type="http" src="http://127.0.0.1/ttXOforNavigator.xml" request="true"/>
<grid id="brXo" datapath="dsXoNavigator:/ttXOforNavigator" contentdatapath="ttXOforNavigatorRow" x="20" y="158" width="745" height="263" rowheight="15" showhlines="true" bgcolor="white">
<gridtext width="60" datapath="XONum/text()" editable="false">Our!Exch #</gridtext>
<gridtext width="50" datapath="NextFollowUpDt/text()" editable="false"> Next!Follow-up
<handler name="ondata">
Debug.write("ondata fired");
</handler>
</gridtext>
<gridtext width="50" datapath="XchTypeNm/text()" editable="false">Exchange!Type</gridtext>
<gridtext width="40" datapath="XchStatusNm/text()" editable="false">Status</gridtext>
<gridtext width="50" datapath="XchDt/text()" editable="false">Date!Entered</gridtext>
<gridtext width="100" datapath="ItemToCustNum/text()" editable="false">Exchange!Part #</gridtext>
<gridtext width="120" datapath="ItemToCustNm/text()" editable="false">Part!Description</gridtext>
<gridtext width="70" datapath="BillToCustNum/text()" editable="false">Customer #</gridtext>
<gridtext width="80" datapath="CustomerXONum/text()" editable="false">Customer!RO #</gridtext>
<gridtext width="66" datapath="WoNum/text()" editable="false">WO/RCVR#</gridtext>
</grid>
</canvas>

<?xml version="1.0"?><ttXOforNavigator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ttXOforNavigatorRow>
<XOId>1001</XOId>
<BillToEntId>2039</BillToEntId>
<ByPassReservation>false</ByPassReservation>
<CompanyEntId>1006</CompanyEntId>
<ContactEntId>0</ContactEntId>
<ConversionDtTm xsi:nil="true"/>
<CurrentDueByDt xsi:nil="true"/>
<CustomerXONum/>
<ElectronicDocNm/>
<EnteredByUserProfile>jimbai</EnteredByUserProfile>
<FromCustomerPartCondCn>AR</FromCustomerPartCondCn>
<ItemIdFromCustomer>1505</ItemIdFromCustomer>
<ItemIdToCustomer>1505</ItemIdToCustomer>
<IsLoan>false</IsLoan>
<PromisedDeliveryDt xsi:nil="true"/>
<SODerOk>false</SODerOk>
<SOPmaOK>false</SOPmaOK>
<ShipToEntId>2039</ShipToEntId>
<ToCustomerPartCondCn>OVH</ToCustomerPartCondCn>
<XchBillTypeCn>PPD</XchBillTypeCn>
<XchDt>2007-10-31</XchDt>
<XchStatusCn>V</XchStatusCn>
<XchTypeCn>ADV</XchTypeCn>
<XONum>X0001001</XONum>
<BillToCustNm>Lloyd</BillToCustNm>
<BillToCustNum>120005</BillToCustNum>
<CompanyNm>ATI</CompanyNm>
<ContactNm/>
<ItemToCustNm>Outer Liner, Combustion Chamber Assembly</ItemToCustNm>
<ItemToCustNum>JA6008T95G01</ItemToCustNum>
<NextFollowUpDt>2007-11-01</NextFollowUpDt>
<NextFollowUpType>Customer Contract Approval</NextFollowUpType>
<XchTypeNm>Advance</XchTypeNm>
<XchStatusNm>Void</XchStatusNm><WoNum/>
</ttXOforNavigatorRow>
<ttXOforNavigatorRow>
<XOId>1002</XOId>
<BillToEntId>2146</BillToEntId>
<ByPassReservation>true</ByPassReservation>
<CompanyEntId>1006</CompanyEntId>
<ContactEntId>0</ContactEntId>
<ConversionDtTm xsi:nil="true"/>
<CurrentDueByDt xsi:nil="true"/>
<CustomerXONum>B000023819</CustomerXONum>
<ElectronicDocNm/>
<EnteredByUserProfile>seamcl</EnteredByUserProfile>
<FromCustomerPartCondCn>AR</FromCustomerPartCondCn>
<ItemIdFromCustomer>1365</ItemIdFromCustomer>
<ItemIdToCustomer>1365</ItemIdToCustomer>
<IsLoan>false</IsLoan>
<PromisedDeliveryDt xsi:nil="true"/>
<SODerOk>true</SODerOk>
<SOPmaOK>true</SOPmaOK>
<ShipToEntId>2146</ShipToEntId>
<ToCustomerPartCondCn>OVH</ToCustomerPartCondCn>
<XchBillTypeCn>FLR</XchBillTypeCn>
<XchDt>2007-11-02</XchDt>
<XchStatusCn>O</XchStatusCn>
<XchTypeCn>PLN</XchTypeCn>
<XONum>X0001002</XONum>
<BillToCustNm>Israel</BillToCustNm>
<BillToCustNum>45001</BillToCustNum>
<CompanyNm>ATI</CompanyNm><ContactNm/>
<ItemToCustNm>Combustion Chamber</ItemToCustNm>
<ItemToCustNum>803115</ItemToCustNum>
<NextFollowUpDt>2007-11-03</NextFollowUpDt>
<NextFollowUpType>Outbound Unit Shipped</NextFollowUpType>
<XchTypeNm>Planned</XchTypeNm>
<XchStatusNm>Open</XchStatusNm>
<WoNum>W0026433</WoNum>
</ttXOforNavigatorRow>
</ttXOforNavigator>

rcyeager
12-18-2008, 09:33 AM
Found a thread that solves this using a gridcolumn and text view together:

http://forum.openlaszlo.org/showthread.php?t=7890&highlight=gridtext+format

Robert Yeager
http://www.qrowd.com
http://www.cooqy.com

Frankhil
12-21-2008, 09:21 AM
Thanks, that solved the problem.