Skip to content

Commit 10961f8

Browse files
committed
tables: remove __id field, look like vuejs add this
1 parent 4cace10 commit 10961f8

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

uliweb_apijson/tables/templates/Tables/inc/table_config.html

+12-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h3>table parameter</h3>
2525
</pre>
2626
<h3>example backend code</h3>
2727
<pre>
28-
table = functions.get_apijson_table("{table.model_name}", role="{table.role}", tableui_name="{table.tableui_name}")
28+
table = functions.get_apijson_table("{table.model_name}", role="{table.role}", request_tag="{table.request_tag}", tableui_name="{table.tableui_name}")
2929
</pre>
3030
<h3>example frontend code</h3>
3131
<pre>
@@ -57,16 +57,14 @@ <h3>settings.APIJSON_REQUESTS.{table.request_tag||table.model_name}</h3>
5757
return {
5858
current_menu_item: "table_param",
5959
table_param: {},
60-
tableui: {}
60+
tableui: {},
61+
tableui_json: ""
6162
}
6263
},
6364
computed: {
6465
table_json: function(){
6566
return JSON.stringify(this.table_param, null, 2)
6667
},
67-
tableui_json: function(){
68-
return JSON.stringify(this.tableui, null, 2)
69-
},
7068
model_json: function(){
7169
return JSON.stringify(this.model, null, 2)
7270
},
@@ -82,7 +80,15 @@ <h3>settings.APIJSON_REQUESTS.{table.request_tag||table.model_name}</h3>
8280
mounted: function(){
8381
this.table_param = JSON.parse(JSON.stringify(this.table))
8482
delete this.table_param.tableui
85-
this.tableui = this.table.tableui
83+
//remove __id field, look like vuejs add this
84+
var tableui = JSON.parse(JSON.stringify(this.table.tableui))
85+
if (tableui.table_fields!=null) {
86+
for (let index = 0; index < tableui.table_fields.length; index++) {
87+
if (tableui.table_fields[index].__id!=null)
88+
delete tableui.table_fields[index].__id
89+
}
90+
this.tableui_json = JSON.stringify(tableui, null, 2)
91+
}
8692
}
8793
})
8894
</script>

0 commit comments

Comments
 (0)