jdoody
11-14-2005, 08:42 AM
I'm attempting to drive the display of a <list> based on the selection from a combobox. In rolesCombo below,
a roleID is selected. At this point a pointer is passed to view vwCurrentFeatures which subsequently fires
the ondata event. Method loadFeatures() is called via the ondata event. In loadFeatures() I'm attempting
to dynamically build the features list associated with the roleID chosen by the user. Here is an example
of the dynamically built datapath:
dsRoleFeatures:/list/role_features/role_id='2'
When I execute this, I would expect to see feature ids (feature_id) 2 and 3 based on the following sample
datasets. However, none are being displayed in the list. Maybe I'm going about this the wrong way or I'm doing something wrong in this code. I would appreciate some direction in dynamically driving the population of the list. Following are the datasets and some code snippets:
dsRoles dataset:
<list>
<role>
<role_description>Application Administration</role_description>
<role_id>1</role_id>
<role_name>Administrator</role_name>
</role>
<role>
<role_description>Test Administrator</role_description>
<role_id>2</role_id>
<role_name>Test Admin</role_name>
</role>
<role>
<role_description>Test User </role_description>
<role_id>3</role_id>
<role_name>TestUser</role_name>
</role>
</list>
dsRoleFeatures dataset:
<list>
<role_features>
<feature_id>1</feature_id>
<role_feature_id>358</role_feature_id>
<role_id>1</role_id>
</role_features>
<role_features>
<feature_id>2</feature_id>
<role_feature_id>545</role_feature_id>
<role_id>2</role_id>
</role_features>
<role_features>
<feature_id>3</feature_id>
<role_feature_id>546</role_feature_id>
<role_id>2</role_id>
</role_features>
</list>
<view>
<simplelayout axis="y" spacing="10"/>
<combobox id="rolesCombo" width="200" editable="false" defaulttext="choose a role...">
<textlistitem id="workingRole" datapath="dsRoles:/list/role/" text="$path{'role_name/text()'}" value="$path{'@value'}">
<method event="onclick">
vwCurrentFeatures.datapath.setPointer( this.datapath.p );
</method>
</textlistitem>
</combobox>
<view id="vRoleName" datapath="">
<simplelayout axis="x" spacing="10"/>
<edittext id="roleName" datapath="role_name/text()" maxlength="50" width="200" text="$path{'role_name/text()'}" visible="true"> </edittext>
<text id="roleID" datapath="role_id/text()" text="$path{'role_id/text()'}" visible="false"></text>
</view>
</view>
<view id="vwCurrentFeatures" datapath="" ondata="loadFeatures()">
<simplelayout axis="y" spacing="10"/>
<method name="loadFeatures">
var roleFeaturePath = "dsRoleFeatures:/list/role_features/feature_id='"+roleID.getText()+"'";
currentFeaturesList.setDatapath(roleFeaturePath);
Debug.write("roleFeaturePath: "+roleFeaturePath);
Debug.write("Current role ID: "+roleID.getText());
</method>
<list id="currentFeaturesList" multiselect="true" width="250" shownitems="10">
<textlistitem id="currFeaturesList" datapath="" text="$path{'feature_id/text()'}" value="$path{'@value'}">
<method event="onclick">
var val = currentFeaturesList.getValue();
currentFeatures.setText(val);
</method>
</textlistitem>
</list>
</view>
Thanks.
John
a roleID is selected. At this point a pointer is passed to view vwCurrentFeatures which subsequently fires
the ondata event. Method loadFeatures() is called via the ondata event. In loadFeatures() I'm attempting
to dynamically build the features list associated with the roleID chosen by the user. Here is an example
of the dynamically built datapath:
dsRoleFeatures:/list/role_features/role_id='2'
When I execute this, I would expect to see feature ids (feature_id) 2 and 3 based on the following sample
datasets. However, none are being displayed in the list. Maybe I'm going about this the wrong way or I'm doing something wrong in this code. I would appreciate some direction in dynamically driving the population of the list. Following are the datasets and some code snippets:
dsRoles dataset:
<list>
<role>
<role_description>Application Administration</role_description>
<role_id>1</role_id>
<role_name>Administrator</role_name>
</role>
<role>
<role_description>Test Administrator</role_description>
<role_id>2</role_id>
<role_name>Test Admin</role_name>
</role>
<role>
<role_description>Test User </role_description>
<role_id>3</role_id>
<role_name>TestUser</role_name>
</role>
</list>
dsRoleFeatures dataset:
<list>
<role_features>
<feature_id>1</feature_id>
<role_feature_id>358</role_feature_id>
<role_id>1</role_id>
</role_features>
<role_features>
<feature_id>2</feature_id>
<role_feature_id>545</role_feature_id>
<role_id>2</role_id>
</role_features>
<role_features>
<feature_id>3</feature_id>
<role_feature_id>546</role_feature_id>
<role_id>2</role_id>
</role_features>
</list>
<view>
<simplelayout axis="y" spacing="10"/>
<combobox id="rolesCombo" width="200" editable="false" defaulttext="choose a role...">
<textlistitem id="workingRole" datapath="dsRoles:/list/role/" text="$path{'role_name/text()'}" value="$path{'@value'}">
<method event="onclick">
vwCurrentFeatures.datapath.setPointer( this.datapath.p );
</method>
</textlistitem>
</combobox>
<view id="vRoleName" datapath="">
<simplelayout axis="x" spacing="10"/>
<edittext id="roleName" datapath="role_name/text()" maxlength="50" width="200" text="$path{'role_name/text()'}" visible="true"> </edittext>
<text id="roleID" datapath="role_id/text()" text="$path{'role_id/text()'}" visible="false"></text>
</view>
</view>
<view id="vwCurrentFeatures" datapath="" ondata="loadFeatures()">
<simplelayout axis="y" spacing="10"/>
<method name="loadFeatures">
var roleFeaturePath = "dsRoleFeatures:/list/role_features/feature_id='"+roleID.getText()+"'";
currentFeaturesList.setDatapath(roleFeaturePath);
Debug.write("roleFeaturePath: "+roleFeaturePath);
Debug.write("Current role ID: "+roleID.getText());
</method>
<list id="currentFeaturesList" multiselect="true" width="250" shownitems="10">
<textlistitem id="currFeaturesList" datapath="" text="$path{'feature_id/text()'}" value="$path{'@value'}">
<method event="onclick">
var val = currentFeaturesList.getValue();
currentFeatures.setText(val);
</method>
</textlistitem>
</list>
</view>
Thanks.
John