I have a following ds:
This ds is connected to the following ListGrid
Here's my problem the discovery_profile_broadcast works as expected and bring back the disc_dmserver_id , which is value field, but the OptionDataSource throws error and I'm interested to catch this error. How can I hook up to the ListGridField to get the errors or the error code if it was thrown ?
If it is impossible - how can I find if the dmServerField has valueMap for the value I got in the discovery_profile_broadcast ?
Al I want to display an empty string in the dmServerField if the optionDataSource returned the Status which is not STATUS_SUCCESS.
old client support: SmartClient Version: v9.0p_2014-04-23/PowerEdition Deployment (built 2014-04-23)
Code:
<DataSource tableName="discovery_profile" ID="discovery_profile_broadcast" dataSourceVersion="1" serverType="sql" > <fields> <field primaryKey="true" name="disc_id" type="sequence" sequenceName="s_discovery_profile" hidden="true"></field> <field name="disc_dmserver_id" type="number" optionDataSource="dm_server" displayField="dm_name" valueField="dm_server_id" title="Server" required="true"></field> </fields>
Code:
final ListGrid discoveryListGrid = new ListGrid() ; discoveryListGrid.setDataFetchMode( FetchMode.BASIC ); discoveryListGrid.setDataSource( dataSource ); //the datasource is the one you can see on the top block : discovery_profile_broadcast final ListGridField dmServerField = new ListGridField("disc_dmserver_id", "Server") ); discoveryListGrid.setFields(dmServerField ); final DSRequest requestProperties = new DSRequest(); requestProperties.setWillHandleError(true); discoveryListGrid.fetchData(null, new DSCallback() { @Override public void execute(DSResponse response, Object data, DSRequest request) { if( response.getStatus() != DSResponse.STATUS_SUCCESS ) { System.out.println("Status " + response.getStatus()); } else { Record[] records = response.getData(); for ( Record record : records ) { String setId = record.getAttribute("disc_dmserver_id");//The id is found //can this value be mapped to any EXISTING values at the dmServerField ? Does it have the display value ? //if there is no "display value" exists I want to display empty string instead of setId value.... } } } }, requestProperties);
If it is impossible - how can I find if the dmServerField has valueMap for the value I got in the discovery_profile_broadcast ?
Al I want to display an empty string in the dmServerField if the optionDataSource returned the Status which is not STATUS_SUCCESS.
old client support: SmartClient Version: v9.0p_2014-04-23/PowerEdition Deployment (built 2014-04-23)
Comment