Update pages/Content_Display/demo_table.py
Browse files
pages/Content_Display/demo_table.py
CHANGED
@@ -159,7 +159,7 @@ ss.space("mt-8")
|
|
159 |
|
160 |
ss.write('''
|
161 |
---
|
162 |
-
#### π
|
163 |
''')
|
164 |
|
165 |
ss.md('''
|
@@ -170,39 +170,26 @@ data = {'name': ['π§π» Alice', 'π¦π» Bob', 'π¦π» Charlie'],
|
|
170 |
'age': [25, 30, 35],
|
171 |
'city': [':sunny: New York', ':cloud: San Francisco', ':sunny: Los Angeles'],
|
172 |
'health':[90,80,60]
|
173 |
-
|
|
|
174 |
df = pd.DataFrame(data)
|
175 |
|
176 |
-
|
177 |
-
<template>
|
178 |
-
<v-row>
|
179 |
-
<v-rating
|
180 |
-
v-model="rating" density="compact" color="orange" half-increments></v-rating>
|
181 |
-
<v-chip variant="text">{{item.value}}</v-chip>
|
182 |
-
</v-row>
|
183 |
-
</template>
|
184 |
|
185 |
-
<script>
|
186 |
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
}
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
},
|
201 |
-
}
|
202 |
-
</script>
|
203 |
-
\'''
|
204 |
-
|
205 |
-
ss.table(df, custom_columns = ["city"], vue_columns = ["health"], vue_code = vuecode)
|
206 |
```
|
207 |
''')
|
208 |
|
|
|
159 |
|
160 |
ss.write('''
|
161 |
---
|
162 |
+
#### π Code
|
163 |
''')
|
164 |
|
165 |
ss.md('''
|
|
|
170 |
'age': [25, 30, 35],
|
171 |
'city': [':sunny: New York', ':cloud: San Francisco', ':sunny: Los Angeles'],
|
172 |
'health':[90,80,60]
|
173 |
+
}
|
174 |
+
|
175 |
df = pd.DataFrame(data)
|
176 |
|
177 |
+
cols = ss.columns([70,"flex:30; border-left:1px solid lightgray"], design=True, style="border:1px solid lightgray")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
|
|
179 |
|
180 |
+
jscode = """
|
181 |
+
//console.log(test)
|
182 |
+
if(item.col == "city")
|
183 |
+
return md(item.value);
|
184 |
+
else{
|
185 |
+
var rating = item.value/20
|
186 |
+
return '<el-rate :model-value="' + rating + '" disabled />'
|
187 |
+
}
|
188 |
+
return res;/// "<el-tag>" + item.value + "</el-tag>";
|
189 |
+
"""
|
190 |
+
|
191 |
+
mytable_ex = ss.table(df, custom_fields = ["city", "health"], cell_render = jscode, border = True)
|
192 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
```
|
194 |
''')
|
195 |
|