File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ define([
32
32
this . config . dataview = false ;
33
33
34
34
this . state = {
35
+ featureData : '' ,
36
+ targetData : '' ,
35
37
testSize : 0.25 ,
36
38
trainFeatures : 'X_train' ,
37
39
trainTarget : 'y_train' ,
@@ -60,6 +62,35 @@ define([
60
62
sizeOptions += `<option value="0.${ i } " ${ this . state . testSize == ( '0.' + i ) ?'selected' :'' } >${ i } %</option>` ;
61
63
}
62
64
$ ( page ) . find ( '#testSize' ) . html ( sizeOptions ) ;
65
+
66
+ // load state
67
+ let that = this ;
68
+ Object . keys ( this . state ) . forEach ( key => {
69
+ let tag = $ ( page ) . find ( '#' + key ) ;
70
+ let tagName = $ ( tag ) . prop ( 'tagName' ) ; // returns with UpperCase
71
+ let value = that . state [ key ] ;
72
+ if ( value == undefined ) {
73
+ return ;
74
+ }
75
+ switch ( tagName ) {
76
+ case 'INPUT' :
77
+ let inputType = $ ( tag ) . prop ( 'type' ) ;
78
+ if ( inputType == 'text' || inputType == 'number' ) {
79
+ $ ( tag ) . val ( value ) ;
80
+ break ;
81
+ }
82
+ if ( inputType == 'checkbox' ) {
83
+ $ ( tag ) . prop ( 'checked' , value ) ;
84
+ break ;
85
+ }
86
+ break ;
87
+ case 'TEXTAREA' :
88
+ case 'SELECT' :
89
+ default :
90
+ $ ( tag ) . val ( value ) ;
91
+ break ;
92
+ }
93
+ } )
63
94
return page ;
64
95
}
65
96
You can’t perform that action at this time.
0 commit comments