cwUi : Create message changed 'value' field to 'children'.

This commit is contained in:
kevin.larke 2020-03-24 08:53:42 -04:00
parent 938e8c284d
commit 1a11282915
3 changed files with 5 additions and 3 deletions

View File

@ -157,7 +157,7 @@ namespace cw
newEle = _createEle( p, parentEle, appId, jsId ); newEle = _createEle( p, parentEle, appId, jsId );
unsigned i = snprintf( buf, bufN, "{ \"op\":\"create\", \"parent\":\"%s\", \"value\":{ \"%s\":{ \"jsId\":\"%s\", \"appId\":%i, \"uuId\":%i, \"class\":\"%s\", \"title\":\"%s\" ", parentJsId, eleTypeStr, jsId, appId, newEle->uuId, clas, title ); unsigned i = snprintf( buf, bufN, "{ \"op\":\"create\", \"parent\":\"%s\", \"children\":{ \"%s\":{ \"jsId\":\"%s\", \"appId\":%i, \"uuId\":%i, \"class\":\"%s\", \"title\":\"%s\" ", parentJsId, eleTypeStr, jsId, appId, newEle->uuId, clas, title );
i = format_attributes(buf, bufN, i, std::forward<ARGS>(args)...); i = format_attributes(buf, bufN, i, std::forward<ARGS>(args)...);

View File

@ -484,7 +484,7 @@ function ws_on_msg( jsonMsg )
switch( d.op ) switch( d.op )
{ {
case 'create': case 'create':
for (const ele_type in d.value) for (const ele_type in d.children)
{ {
ui_create( d.parent, ele_type, d.value[ele_type] ) ui_create( d.parent, ele_type, d.value[ele_type] )
//console.log(`${ele_type}: ${d.value[ele_type]}`); //console.log(`${ele_type}: ${d.value[ele_type]}`);

View File

@ -1,12 +1,14 @@
{ {
div: { div: {
title:"My panel", title:"My panel",
children: { children: {
button:{ id:myBtnId, title:"Push Me" }, button:{ id:myBtnId, title:"Push Me" },
select:{ id:mySelectId, title:"Selector", optionL: { myId0:"Option 0", myId2:"Option 1", myId3:"Option 3" }} check:{ id:myCheckId, title:"Check Me" },
select:{ id:mySelectId, title:"Selector", values: [ myId0:"Option 0", myId2:"Option 1", myId3:"Option 3" ] }
} }