|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& G: x. B" h$ B! z
8 S) J @9 r0 H4 V, x2 v# Y$ o3 q: N) Q7 kTechnique , ?/ l5 j. U$ v" w/ y! ^3 w* L# H
Use the Item.getNextStates() method to get the next state values. This recipe
0 N5 j" A d) P5 passumes there is a select input field on the form for us to populate with state values. / `1 D6 r: D# [7 n3 L
HTML
1 V$ }2 X2 g6 g<select id="mySelect"></select>
' L: |/ E1 s5 R" E1 c! EJavaScript
4 [. b! D' j& n/ R/ T& @7 t' jvar results = document.thisItem.getNextStates(); 4 _6 u4 M& p; t; P% Q9 D
var nextStates = results.getItemsByXPath('//Item[@type="Life Cycle State"]');
5 A i9 k$ m- s7 Y4 zvar count = nextStates.getItemCount();
4 m8 ^- Y$ B' a; R: m, K/ P: f3 K Q$ t
! D) l+ f! `, n* b3 \" E8 E5 bvar oSelect = document.getElementById('mySelect'); ) F- p, {: g2 Q6 [
for (var i=0; i<count; ++i) {
+ O0 f. [) ~; _9 A var item = nextStates.getItemByIndex(i); 7 q) L. O9 R9 G: S# j
var opt = document.createElement('option'); 6 h, H7 Z2 Q+ `6 s: b
opt.text = item.getProperty('name');
& K" ~7 }1 O/ I" K' C/ a oSelect.add(opt); - K) @, h' b4 J$ e( n5 v4 d
}
3 o5 v7 U7 L" `$ [
. {+ m$ [- a0 A2 K' l |
|