Browse Source

fix: amend dix for 11124492

wangweimin 4 years ago
parent
commit
b354bd7ca2
2 changed files with 3 additions and 7 deletions
  1. 2 7
      pywebio/output.py
  2. 1 0
      test/13.misc.py

+ 2 - 7
pywebio/output.py

@@ -434,7 +434,7 @@ def _format_button(buttons):
     return btns
     return btns
 
 
 
 
-def table_cell_buttons(buttons, onclick, **callback_options) -> str:
+def table_cell_buttons(buttons, onclick, **callback_options) -> Output:
     """
     """
     在表格中显示一组按钮
     在表格中显示一组按钮
 
 
@@ -461,12 +461,7 @@ def table_cell_buttons(buttons, onclick, **callback_options) -> str:
     """
     """
     logger.warning("pywebio.output.table_cell_buttons() is deprecated in version 0.3 and will be removed in 1.0, "
     logger.warning("pywebio.output.table_cell_buttons() is deprecated in version 0.3 and will be removed in 1.0, "
                    "use pywebio.output.put_buttons() instead.")
                    "use pywebio.output.put_buttons() instead.")
-    btns = _format_button(buttons)
-    callback_id = output_register_callback(onclick, **callback_options)
-    tpl = '<button type="button" value="{value}" class="btn btn-primary btn-sm" ' \
-          'onclick="WebIO.DisplayAreaButtonOnClick(this, \'%s\')">{label}</button>' % callback_id
-    btns_html = [tpl.format(**b) for b in btns]
-    return ' '.join(btns_html)
+    return put_buttons(buttons, onclick, small=True, **callback_options)
 
 
 
 
 def put_buttons(buttons, onclick, small=None, link_style=False, scope=Scope.Current, position=OutputPosition.BOTTOM,
 def put_buttons(buttons, onclick, small=None, link_style=False, scope=Scope.Current, position=OutputPosition.BOTTOM,

+ 1 - 0
test/13.misc.py

@@ -48,6 +48,7 @@ def target():
     except Exception:
     except Exception:
         pass
         pass
 
 
+    # test deprecated api
     put_table([
     put_table([
         ['Idx', 'Actions'],
         ['Idx', 'Actions'],
         ['1', table_cell_buttons(['edit', 'delete'], onclick=lambda _: None)],
         ['1', table_cell_buttons(['edit', 'delete'], onclick=lambda _: None)],