Single column data is displayed in a table

ask God, the effect shown in figure 3 at the front end, the number of data in the background is random, there may be up to 80 items, and there is also the ability to submit data. How to write the code?

Mar.22,2021

take a brief look at the problem, the desired effect is to put the four records of the database into table.
then you must be able to get the list of these four records, if it is List < T > list.
below, pass the list to the foreground, and then loop through it.

var html = '<tr>';
for(var i = 0,i<list.length;iPP)
{
    html += '<td>"list[i].zi"</td>';
}
html += '</tr>';
The key to the question of

is how many rows and columns there are. So, just figure out how many tr and td there are.


var trs ='< tr >';

    for(var i=0;i<80;iPP){
        if(i==9 || i==19 || i==29 || i==39 || i==49 || i==59 || i==69){
            if(i<d.mxs.length){
                trs += '<td style="padding: 0px;"><input type="text" name="data['+i+'][zl]" value="'+d.mxs[i]['zl']+'" class="layui-input" autocomplete="off"></td></tr><tr>';
            }else{
                trs += '<td style="padding: 0px;"><input type="text" name="data['+i+'][zl]" class="layui-input" autocomplete="off"></td></tr><tr>';
            }          
        }else{
            if(i<d.mxs.length){
                trs += '<td style="padding: 0px;"><input type="text" name="data['+i+'][zl]" value="'+d.mxs[i]['zl']+'" class="layui-input" autocomplete="off"></td>';
            }else{
               trs += '<td style="padding: 0px;"><input type="text" name="data['+i+'][zl]]" class="layui-input" autocomplete="off"></td>'; 
            }
            
        }
                   
    }
    trs += '</tr>';$('-sharpgoodsKc-form-table tbody').append(trs);

d.mxs is the data returned by the background

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4121f-4490c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4121f-4490c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?