File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ define([
3232 this . config . dataview = false ;
3333
3434 this . state = {
35+ featureData : '' ,
36+ targetData : '' ,
3537 testSize : 0.25 ,
3638 trainFeatures : 'X_train' ,
3739 trainTarget : 'y_train' ,
@@ -60,6 +62,35 @@ define([
6062 sizeOptions += `<option value="0.${ i } " ${ this . state . testSize == ( '0.' + i ) ?'selected' :'' } >${ i } %</option>` ;
6163 }
6264 $ ( 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+ } )
6394 return page ;
6495 }
6596
You can’t perform that action at this time.
0 commit comments