当前位置:网站首页>动态生成表格
动态生成表格
2022-07-06 22:37:00 【抱抱旋旋子】
创建学生数据
因为里面的学生数据都是动态的,我们需要s动态生成。这里我们模拟数据,自己定义好数据。
因为里面的数据有好多好多个,所以我们采取数组的形式来存储,每个数组里面的元素是一个对象
创建行
因为里面的学生数据都是动态的,我们需要js动态生成。这里我们模拟数据,自己定义好数据。数据我们采取对象形式存储。
所有的数据都是放到tbody里面的行里面。
因为行很多,我们需要循环创建多个行(对应多少人)
创建单元格
每个行里面又有很多单元格(对应里面的数据),我们还继续使用循环创建多个单元格,并且把数据存入里面(双重for循环)
单元格填充数据
注意:
for(var k in obj) {
k 得到的是属性名
obj[k] 得到是属性值
}
创建删除单元格
最后一列单元格是删除,需要单独创建单元格。
添加删除操作
注意:删除是在所有的行和单元格都创建完后再去删除,所以得放到for循环下面
下面是动态生成表格的所有代码
边栏推荐
- If you ask me about R code debugging, I will tell you head, STR, help
- National meteorological data / rainfall distribution data / solar radiation data /npp net primary productivity data / vegetation coverage data
- MySQL forgot how to change the password
- How to package the parsed Excel data into objects and write this object set into the database?
- Flex layout and usage
- Read of shell internal value command
- Ansible中的inventory主机清单(预祝你我有数不尽的鲜花和浪漫)
- 关于01背包个人的一些理解
- Operand of null-aware operation ‘!‘ has type ‘SchedulerBinding‘ which excludes null.
- R语言主成分pca、因子分析、聚类对地区经济研究分析重庆市经济指标
猜你喜欢
How to package the parsed Excel data into objects and write this object set into the database?
[line segment tree practice] recent requests + area and retrieval - array modifiable + my schedule I / III
MySQL forgot how to change the password
Function pointer and pointer function in C language
A line of R code draws the population pyramid
5G VoNR+之IMS Data Channel概念
程序员上班摸鱼,这么玩才高端!
mpf2_ Linear programming_ CAPM_ sharpe_ Arbitrage Pricin_ Inversion Gauss Jordan_ Statsmodel_ Pulp_ pLU_ Cholesky_ QR_ Jacobi
01 machine learning related regulations
DFS和BFS概念及实践+acwing 842 排列数字(dfs) +acwing 844. 走迷宫(bfs)
随机推荐
Lessons and thoughts of the first SQL injection
acwing 843. n-皇后问题
C语言中函数指针与指针函数
U++4 接口 学习笔记
Code source de la fonction [analogique numérique] MATLAB allcycles () (non disponible avant 2021a)
Local tool [Navicat] connects to remote [MySQL] operation
What is JVM? What are the purposes of JVM tuning?
STM32F103ZE+SHT30检测环境温度与湿度(IIC模拟时序)
AttributeError: module ‘torch._C‘ has no attribute ‘_cuda_setDevice‘
namespace基础介绍
Wechat can play the trumpet. Pinduoduo was found guilty of infringement. The shipment of byte VR equipment ranks second in the world. Today, more big news is here
Leetcode notes
STM32F103实现IAP在线升级应用程序
《原动力 x 云原生正发声 降本增效大讲堂》第三讲——Kubernetes 集群利用率提升实践
Why do many people misunderstand technical debt
九章云极DataCanvas公司蝉联中国机器学习平台市场TOP 3
【數模】Matlab allcycles()函數的源代碼(2021a之前版本沒有)
Operand of null-aware operation ‘!‘ has type ‘SchedulerBinding‘ which excludes null.
什么是Web3
Can I specify a path in an attribute to map a property in my class to a child property in my JSON?