html/preset_sel/index.html, js/ui.js : The main app. div is now created rather than statically constructed.

Fixed bug where the values of numbers without min/max ranges were not updated correctly.
Fixed bug where elements with 'order' attribute were not ordered correctly when created.

Signed-off-by: kevin <kevin@larke.org>
This commit is contained in:
kevin 2022-12-13 20:54:56 -05:00
parent f3aecb1177
commit 13bc47389b
2 changed files with 11 additions and 8 deletions

View File

@ -19,8 +19,6 @@
<p id="connectTitleId">Disconnected</p> <p id="connectTitleId">Disconnected</p>
</div> </div>
<div id="0" class="uiAppDiv">
</div>
</body> </body>
</html> </html>

View File

@ -329,8 +329,8 @@ function ui_create_ele( parent_ele, ele_type, d, dfltClassName )
parent_ele.appendChild(ele); parent_ele.appendChild(ele);
if( d.hasOwnProperty('order') )
ui_set_order_key(ele,d.order)
} }
return ele return ele
@ -683,7 +683,10 @@ function _ui_set_number_range( ele, d )
function ui_set_number_value( ele, value ) function ui_set_number_value( ele, value )
{ {
if( ele.minValue <= value && value <= ele.maxValue ) var min_ok_fl = (!ele.hasOwnProperty('minValue')) || (value >= ele.minValue)
var max_ok_fl = (!ele.hasOwnProperty('maxValue')) || (value <= ele.maxValue)
if( min_ok_fl && max_ok_fl )
{ {
ele.value = value; ele.value = value;
if( ele.decpl == 0 ) if( ele.decpl == 0 )
@ -1252,7 +1255,9 @@ function ws_form_url(urlSuffix)
function main() function main()
{ {
rootEle = dom_id_to_ele(_rootId); d = { "className":"uiAppDiv", "uuId":_rootId }
rootEle = ui_create_div( document.body, d )
//rootEle = dom_id_to_ele(_rootId);
rootEle.uuId = 0; rootEle.uuId = 0;
rootEle.id = _nextEleId; rootEle.id = _nextEleId;
_nextEleId += 1; _nextEleId += 1;