@@ -172,6 +172,7 @@ define([
172172 */
173173 PandasPackage . prototype . initHtml = function ( ) {
174174 this . showFunctionTitle ( ) ;
175+ this . loadCss ( Jupyter . notebook . base_url + vpConst . BASE_PATH + vpConst . STYLE_PATH + "pandas/commonPandas.css" ) ;
175176 this . loadCss ( Jupyter . notebook . base_url + vpConst . BASE_PATH + vpConst . STYLE_PATH + "file_io/fileio.css" ) ;
176177
177178 this . bindOptions ( ) ;
@@ -217,6 +218,20 @@ define([
217218 var selectedType = this . fileState [ pageType ] [ 'selectedType' ] ;
218219 var package = { ...libPandas . _PANDAS_FUNCTION [ fileTypeObj [ selectedType ] ] } ;
219220 this . fileState [ pageType ] . package = package ;
221+ this . state . fileExtension = that . fileExtensions [ selectedType ] ;
222+ this . fileResultState = {
223+ ...this . fileState [ pageType ] . fileResultState
224+ } ;
225+
226+ if ( pageType == 'Write' ) {
227+ if ( selectedType == 'json' ) {
228+ this . fileResultState . pathInputId = this . wrapSelector ( prefix + '#path_or_buf' ) ;
229+ }
230+ if ( selectedType == 'pickle' ) {
231+ this . fileResultState . pathInputId = this . wrapSelector ( prefix + '#path' ) ;
232+ }
233+ }
234+
220235 // render interface
221236 pdGen . vp_showInterfaceOnPage ( this , this . wrapSelector ( '#vp_file' + pageType ) , package ) ;
222237
@@ -238,38 +253,34 @@ define([
238253 $ ( this . wrapSelector ( prefix + '#fileType' ) ) . change ( function ( ) {
239254 var value = $ ( this ) . val ( ) ;
240255 that . fileState [ pageType ] . selectedType = value ;
241- that . state . fileExtension = that . fileExtensions [ value ] ;
242- that . fileResultState = {
243- ...that . fileState [ pageType ] . fileResultState
244- } ;
245-
246- if ( pageType == 'Write' ) {
247- if ( value == 'json' ) {
248- that . fileResultState . pathInputId = that . wrapSelector ( prefix + '#path_or_buf' ) ;
249- }
250- if ( value == 'pickle' ) {
251- that . fileResultState . pathInputId = that . wrapSelector ( prefix + '#path' ) ;
252- }
253- }
254256
255257 // reload
256258 that . renderPage ( pageType ) ;
257259 } ) ;
258260
259261 // 파일 네비게이션 버튼 추가
260- if ( pageType == 'Write' && selectedType == 'json' ) {
261- $ ( this . fileState [ pageType ] [ 'fileResultState' ] [ 'pathInputId' ] ) . parent ( ) . html (
262- vpCommon . formatString ( '<input type="text" class="vp-input input-single" id="path_or_buf" index="0" placeholder="" value="" title=""><div id="vp_openFileNavigationBtn" class="{0}"></div>'
263- , vpConst . FILE_BROWSER_INPUT_BUTTON )
264- ) ;
265- } else if ( pageType == 'Write' && selectedType == 'pickle' ) {
266- $ ( this . fileState [ pageType ] [ 'fileResultState' ] [ 'pathInputId' ] ) . parent ( ) . html (
267- vpCommon . formatString ( '<input type="text" class="vp-input input-single" id="path" index="0" placeholder="" value="" title=""><div id="vp_openFileNavigationBtn" class="{0}"></div>'
268- , vpConst . FILE_BROWSER_INPUT_BUTTON )
269- ) ;
262+ if ( pageType == 'Write' ) {
263+ if ( selectedType == 'json' ) {
264+ $ ( prefix + '#path_or_buf' ) . parent ( ) . html (
265+ vpCommon . formatString ( '<input type="text" class="vp-input input-single" id="path_or_buf" index="0" placeholder="" value="" title=""><div id="vp_openFileNavigationBtn" class="{0}"></div>'
266+ , vpConst . FILE_BROWSER_INPUT_BUTTON )
267+ ) ;
268+ } else if ( selectedType == 'pickle' ) {
269+ $ ( prefix + '#path' ) . parent ( ) . html (
270+ vpCommon . formatString ( '<input type="text" class="vp-input input-single" id="path" index="0" placeholder="" value="" title=""><div id="vp_openFileNavigationBtn" class="{0}"></div>'
271+ , vpConst . FILE_BROWSER_INPUT_BUTTON )
272+ ) ;
273+ } else {
274+ $ ( this . fileState [ pageType ] [ 'fileResultState' ] [ 'pathInputId' ] ) . parent ( ) . html (
275+ vpCommon . formatString ( '<input type="text" class="vp-input input-single" id="{0}" index="0" placeholder="" value="" title=""><div id="vp_openFileNavigationBtn" class="{1}"></div>'
276+ , 'i1'
277+ , vpConst . FILE_BROWSER_INPUT_BUTTON )
278+ ) ;
279+ }
270280 } else {
271281 $ ( this . fileState [ pageType ] [ 'fileResultState' ] [ 'pathInputId' ] ) . parent ( ) . html (
272- vpCommon . formatString ( '<input type="text" class="vp-input input-single" id="i0" index="0" placeholder="" value="" title=""><div id="vp_openFileNavigationBtn" class="{0}"></div>'
282+ vpCommon . formatString ( '<input type="text" class="vp-input input-single" id="{0}" index="0" placeholder="" value="" title=""><div id="vp_openFileNavigationBtn" class="{1}"></div>'
283+ , 'i0'
273284 , vpConst . FILE_BROWSER_INPUT_BUTTON )
274285 ) ;
275286 }
0 commit comments