Line 27: |
Line 27: |
| }; | | }; |
| | | |
− | async function pd_edit_render(){ | + | async function pd_edit_render( swutch ){ |
| + | clear_render(); |
| var orig = wbproc.checkentity( { this_concerns: [ wbEStructure['concernsRelation'], wbEStructure['IDPropLoc'], wbEStructure['IDName'] ] } )['this_concerns'][0]; | | var orig = wbproc.checkentity( { this_concerns: [ wbEStructure['concernsRelation'], wbEStructure['IDPropLoc'], wbEStructure['IDName'] ] } )['this_concerns'][0]; |
| var plch = wbproc.checkentity( { default_value: [ wbEStructure['defaultValRelation'], wbEStructure['IDPropLoc'] ] } )['default_value'][0]; //defal | | var plch = wbproc.checkentity( { default_value: [ wbEStructure['defaultValRelation'], wbEStructure['IDPropLoc'] ] } )['default_value'][0]; //defal |
Line 42: |
Line 43: |
| | | |
| var button_save = [], | | var button_save = [], |
− | button_delete = [], | + | button_remove = [], |
| textInput = []; | | textInput = []; |
| | | |
Line 58: |
Line 59: |
| button_save[ extrafield ].on( 'click', function () { | | button_save[ extrafield ].on( 'click', function () { |
| console.log( "this is happening " + orig + ' :: ' + extrafield); | | console.log( "this is happening " + orig + ' :: ' + extrafield); |
− |
| |
| console.log( "textInput[ extrafield ].value" + textInput[ extrafield ].value ); | | console.log( "textInput[ extrafield ].value" + textInput[ extrafield ].value ); |
− | | + | idxb.EnqueuePDIO('update record', orig, extrafield, textInput[ extrafield ].value ); |
− | idxb.EnqueuePDIO('update record', orig, extrafield, textInput[ extrafield ].value ) | + | pd_edit_render(); |
| }); | | }); |
| | | |
| + | $( '#mw-content-text' ).prepend( button_save[ extrafield ].$element ); |
| $( '#mw-content-text' ).prepend( textInput[ extrafield ].$element ); | | $( '#mw-content-text' ).prepend( textInput[ extrafield ].$element ); |
− | $( '#mw-content-text' ).prepend( '<br>' );
| |
− | $( '#mw-content-text' ).prepend( button_save[ extrafield ].$element );
| |
− | $( '#mw-content-text' ).prepend( '<br>' );
| |
− | $( '#mw-content-text' ).prepend( '<br>' );
| |
| | | |
| if ( extrafield > 0) { | | if ( extrafield > 0) { |
Line 75: |
Line 72: |
| console.log(result[orig]); | | console.log(result[orig]); |
| button_save[data] = new OO.ui.ButtonWidget( { label: "Save", classes: [ 'pddh' ] } ); | | button_save[data] = new OO.ui.ButtonWidget( { label: "Save", classes: [ 'pddh' ] } ); |
− | button_delete[data] = new OO.ui.ButtonWidget( { label: "Delete", classes: [ 'pddh' ] } ); | + | button_remove[data] = new OO.ui.ButtonWidget( { label: "Delete", classes: [ 'pddh' ] } ); |
| textInput[data] = new OO.ui.TextInputWidget( { | | textInput[data] = new OO.ui.TextInputWidget( { |
| value: result[orig][data], /// | | value: result[orig][data], /// |
Line 86: |
Line 83: |
| console.log( "textInput[ extrafield ].value" + textInput[ data ].value ); | | console.log( "textInput[ extrafield ].value" + textInput[ data ].value ); |
| | | |
− | idxb.EnqueuePDIO('update record', orig, data, textInput[ data ].value ) | + | idxb.EnqueuePDIO('update record', orig, data, textInput[ data ].value ); |
| + | |
| + | pd_edit_render(); |
| }); | | }); |
| + | button_remove[data].on( 'click', function () { |
| + | idxb.EnqueuePDIO('remove from record', orig, data ); |
| + | pd_edit_render(); |
| + | } |
| + | $( '#mw-content-text' ).prepend( button_remove[data].$element ); |
| + | $( '#mw-content-text' ).prepend( button_save[data].$element ); |
| $( '#mw-content-text' ).prepend( textInput[data].$element ); | | $( '#mw-content-text' ).prepend( textInput[data].$element ); |
− | $( '#mw-content-text' ).prepend( '<br>' );
| |
− | $( '#mw-content-text' ).prepend( button_delete[data].$element );
| |
− | $( '#mw-content-text' ).prepend( button_save[data].$element );
| |
− | $( '#mw-content-text' ).prepend( '<br>' );
| |
− | $( '#mw-content-text' ).prepend( '<br>' );
| |
− |
| |
− |
| |
| | | |
| }); | | }); |
Line 103: |
Line 101: |
| }); | | }); |
| }; | | }; |
| + | |
| + | function clear_render() { |
| + | var ifel = document.getElementsByClassName('pddh'); |
| + | while(ifel[0]) { |
| + | ifel[0].parentNode.removeChild(ifel[0]); |
| + | } |
| + | }; |
| + | |
| } | | } |