Note |
---|
As of at Weave 2.5.18 you can specify client formatting options for a data definition directly in the |
Below I'm going to outline exactly The following notes outline how to format columns in a data grid.
Firstly lest let's assume that you have the following, or something like it in your defaults section in your client config:
...
Initial client config defaults section
Code Block | ||
---|---|---|
| ||
<defaults>
<entity id="lyr_suburbs />
<entity id="lyr_properties" isDefault="true">
<search>aq_property_by_address_auth</search>
<data>ar_property_address_auth</data>
</entity>
<entity id="lyr_parcels"/>
</defaults>
|
This is just setting some options for some entities, and there may even be other stuff material in there , relating that relates to reports for example.
Then elsewhere Elsewhere in you your config files you would have a data definition and data configuration that look looks like this:
...
Data configuration ready to have it formatting changed
Code Block | ||
---|---|---|
| ||
<data:datadefinition id="__dd__ar_properties_sde">
<datasourcedataconnection datasource="ds_sde" table="PROPERTIES_ACTIVE_REGION" key="PROPERTY_NUMBER" prefix="DISTINCT">
<parameter type="string" name="sp_propno" label="Parcel Number" column="PROPERTY_NUMBER" />
<parameter type="string" name="sp_houseno" label="House Number" column="HOUSE_NUMBER" />
<parameter type="string" name="sp_roadname" label="Road Name" column="STREET_NAME" />
<parameter type="string" name="sp_pubprop" label="Public/State Property" column="PUBLIC_PROPERTIES" />
<parameter type="list" name="lp_landclass" label="Council Land Classification" column="PUBLIC_LAND_IDENTIFIER" list="vl_props_active"/>
<parameter type="string" name="sp_propdesc" label="Property Description" column="PROPERTY_NAME" />
</datasourcedataconnection>
</data:datadefinition>
<data:data id="ar_properties_sde" label="GIS - Property Details" entity="lyr_properties" datadefinition="__dd__ar_properties_sde" />
|
Now lets let us say that you want to set the width for the column that displays the sp_houseno
parameter to 20 pixels and align it to the right, and you want to alter the width for the column that displays the sp_propdesc
parameter to 200 pixels, just for when you display the data for the the ar_properties_sde
data, i.e. when the user select selects the "GIS - Property Details" value in the grid panel combo box.
To do this you first you need to add a <data> section to the defaults (I'll add Add it to the end of the defaults section I quoted above), e.g .
...
Defaults section with empty data configuration section
Code Block | ||
---|---|---|
| ||
<defaults> <entity id="lyr_suburbs /> <entity id="lyr_properties" isDefault="true"> <search>aq_property_by_address_auth</search> <data>ar_property_address_auth</data> </entity> <entity id="lyr_parcels"/> <data> <!-- This is the new data section that I was referring to above, at the moment it doesn't do anything, I'm just showing where it goes, note that I've added it just inside of the defaults tag, and not within an entity tag --> </data> </defaults> |
Now once Once you have the new <data>
section inside of the <defaults>
section, which is inside of your client:config,
you can add a sub-data tag to configure an individual grid, in . In this example we 're are going to be setting the column definitions I outlined above relating to the sp_houseno
and sp_propdesc
columns in the ar_properties_sde
grid.
So to To do this we need to add yet another <data>
tag inside of the one we just added, and give it an id that matched the grid we want to edit, which in . In our example this will be ar_properties_sde
', we . We can do this multiple times to change the display of multiple grids, but for now we 'll will just do it for one grid, like this:
...
Defaults section with empty data configuration section for a single grid
Code Block | ||
---|---|---|
| ||
<defaults> <entity id="lyr_suburbs /> <entity id="lyr_properties" isDefault="true"> <search>aq_property_by_address_auth</search> <data>ar_property_address_auth</data> </entity> <entity id="lyr_parcels"/> <data> <data id="ar_properties_sde"> <!-- This is the new sub-data section that I was just referring to, it still doesn't do anything, I'm just showing where it goes, what we add inside of this will alter the ar_properties_sde data display --> </data> </data> </defaults> |
Ok, so now to To change the individual column formatting options for each parameter we want to change, we have to add a <column>
tag to the <data>
tag we just added, (the one with the id attribute, not the one without the id attribute). In our example we 're are only changing 2 columns, sp_houseno
and sp_propdesc
, the . T
he rest of the parameters defined in _dd_ar_properties_sde
when displayed using the ar_properties_sde
grid will use the default values.
...
Defaults section with a data configuration section to change to columns
Code Block | ||
---|---|---|
| ||
<defaults> <entity id="lyr_suburbs /> <entity id="lyr_properties" isDefault="true"> <search>aq_property_by_address_auth</search> <data>ar_property_address_auth</data> </entity> <entity id="lyr_parcels"/> <data> <data id="ar_properties_sde"> <column id="sp_houseno" width="20" align="right"/> <column id="sp_propdesc" width="200"/> </data> </data> </defaults> |
If you wanted to change other parameters in that grid you could add additional <column>
tags to the <data>
tag , (the one with the id attribute, not the one without the id attribute).
If you wanted to change the parameter display for a column in a data definition other than the ar_properties_sde
grid you would create a new <data>
tag with the id of the data you want to change. For example, for example if we have another data definition and a corresponding a correspondingĀ <data>
(this is the data t6ag tag related to the data definition, not the one we 're are adding here) tag with the id ar_conquest_council_building_details
, so you could add a <data id="ar_conquest_council_building_details">...</data>
tag to the top data tag we just added (the one without the id), like so:
...
Defaults section with multiple data configuration section to alter multiple grid
Code Block | ||
---|---|---|
| ||
<defaults> <entity id="lyr_suburbs /> <entity id="lyr_properties" isDefault="true"> <search>aq_property_by_address_auth</search> <data>ar_property_address_auth</data> </entity> <entity id="lyr_parcels"/> <data> <data id="ar_properties_sde"> <column id="sp_houseno" width="20" align="right"/> <column id="sp_propdesc" width="200"/> </data> <data id="ar_conquest_council_building_details"> <!-- you would add some column tags here like the one above, I haven't done this so this won't actually do anything, but you get idea --> </data> </data> </defaults> |
The final step you could take is if you have If you have the same parameter used in multiple data definition definitions and you want to change all of them at once. To do this you , then add a <column>
tag at the same level as the <data>
tags (the ones with the id's), for . For example, if you wanted to change all of the parameters named strnum
and strname
you would do the following:
...
...
Defaults section with multiple data configuration section to alter multiple grid and globally altering some columns
Code Block | ||
---|---|---|
| ||
<defaults> <entity id="lyr_suburbs /> <entity id="lyr_properties" isDefault="true"> <search>aq_property_by_address_auth</search> <data>ar_property_address_auth</data> </entity> <entity id="lyr_parcels"/> <data> <data id="ar_properties_sde"> <column id="sp_houseno" width="20" align="right"/> <column id="sp_propdesc" width="200"/> </data> <data id="ar_conquest_council_building_details"> <!-- you would add some column tags here like the one above, I haven't done this so this won't actually do anything, but you get idea --> </data> <!-- this is where I'm changing the grid display for some parameter globally, every data definition that's displayed to the user with a parameter with these names will be formatted according to what we do here --> <column id="strnum" width="50" align="right"/> <column id="strname" width="100"/> </data> </defaults> |
Now once Once that 's is done, you should see the change in the column display for those columns we 've have changed.
Formatting in 2.5.18+
As of Weave 2.5.18 you can specify the same sort of formatting information described above directly within theĀ <data:data>
tag that's associated with a data definition, e.g.
Formatting a data definition
Code Block | ||||
---|---|---|---|---|
| ||||
<data:datadefinition id="properties_details"> <datasourcedataconnection datasource="ds_sde" table="PROPERTIES_ACTIVE_REGION" key="PROPERTY_NUMBER" prefix="DISTINCT"> <parameter type="string" name="sp_propno" label="Parcel Number" column="PROPERTY_NUMBER" /> <parameter type="string" name="sp_houseno" label="House Number" column="HOUSE_NUMBER" /> <parameter type="string" name="sp_roadname" label="Road Name" column="STREET_NAME" /> <parameter type="string" name="sp_pubprop" label="Public/State Property" column="PUBLIC_PROPERTIES" /> <parameter type="list" name="lp_landclass" label="Council Land Classification" column="PUBLIC_LAND_IDENTIFIER" list="vl_props_active"/> <parameter type="string" name="sp_propdesc" label="Property Description" column="PROPERTY_NAME" /> <parameter type="float" name="sp_valuation" label="Valuation" column="PROPERTY_VALUATION" /> </datasourcedataconnection> </data:datadefinition> <data:data id="ar_property_details" label="Property Details" entity="lyr_properties" datadefinition="properties_details"> <columns> <column id="sp_propno" align="right" width="40"/> <column id="sp_houseno" align="right" width="40"/> <column id="sp_roadname" width="100"/> <column id="sp_valuation" format="0,000.00"/> <!-- https://docs.sencha.com/extjs/3.4.0/#!/api/Ext.util.Format-method-number --> </columns> </data:data> |
...