ui.js : Added ui_empty().

This commit is contained in:
kevin 2024-09-21 17:20:12 -04:00
parent a47ce5d44f
commit 9524b954b4

View File

@ -1072,6 +1072,25 @@ function ui_destroy( d )
ele.parentElement.removeChild( ele ) ele.parentElement.removeChild( ele )
} }
// Remove all children from the selected element
function ui_empty( d )
{
var ele = dom_id_to_ele(d.uuId.toString())
if( ele == null )
console.log("ele to empty not found");
if( ele != null)
{
let i = 0;
let n = ele.children.length;
for(i=0; i<n; ++i)
{
ele.removeChild(ele.children[0])
}
}
}
function ui_attach( d ) function ui_attach( d )
{ {
console.log("ATTACH"); console.log("ATTACH");
@ -1102,6 +1121,10 @@ function _ws_on_msg( d )
ui_destroy( d ) ui_destroy( d )
break break
case 'empty':
ui_empty(d)
break
case 'value': case 'value':
ui_set_value( d ) ui_set_value( d )
break; break;