Javascript Effectively Build Table From JSON and Add It to DOM

后端 未结 5 1221
感动是毒
感动是毒 2020-12-09 05:59

I have a JSON array coming in from the server with an array of 200 objects each containing another 10 objects that I want to display in a table format. At first I was creati

5条回答
  •  情书的邮戳
    2020-12-09 06:19

    I suggest you to use DocumentFragment and use native javascript for this kind of massive DOM manipulation. I prepared an example, you can check it here.

    var fragment = document.createDocumentFragment(),
        tr, td, i, il, key;
    for(i=0,il=data.length;i

    I think it's the fastest way to do such a job.

提交回复
热议问题