Add tags dynamically and add ms-duplex attributes

dynamically add tags and bind data ms-duplex, found that the binding was not successful

changed the added code to modelData ["+ dataCount+"] .Pretime. Binding can be achieved if it is already written at the beginning.

related codes

var tempmodel = avalon.define({
    $id: "GZBG",
    modelData: [{ "RBDate": ComFunJS.getnowdate("yyyy-mm-dd"), "LeiBie": "", "Files": "", "ChaoSongUser": "" }, { "RBContent": "", "RBWCQK": "", "Describe": "", "PreTime": "", "StartDate": "", "EndDate": "", "ActTime": "","BranchName": "" }],
    addLogD: function() {
        var count = $(this).parent().parent().parent().children("tr");
        var trcont = count.length - 1;
        var dataCount = count.length;
          var m={ "RBContent": "", "RBWCQK": "", "Describe": "", "PreTime": "", "StartDate": "", "EndDate": "", "ActTime": "","BranchName": "" };
        tempmodel.modelData.push(m);
        var htmlStr1 = " <tr class="tr" + trcont + "">";
        htmlStr1 += "<th>" + count.length + "</th>";
        htmlStr1 += " <th calss="form-group text-center">";
        htmlStr1 += "    <input type="text" name="" class="form-control" ms-duplex=" tempmodel.modelData["+dataCount+"] .RBContent" />";
        htmlStr1 += " </th>";
        htmlStr1 += " <th calss="form-group text-center">";
        htmlStr1 += "    <input type="text" name="" class="form-control" ms-duplex=" tempmodel.modelData["+dataCount+"] .Describe" />";
        htmlStr1 += " </th>";
        htmlStr1 += " <th calss="form-group text-center">";
        htmlStr1 += "     <span class="bn" onclick="dellogd(this)"></span>";
        htmlStr1 += "  </th>";
        htmlStr1 += "</tr>";
        $(this).parent().parent().before(htmlStr1);
        var htmlStr2 = "";
        htmlStr2 += "<tr class="tr" + trcont + "">";
        htmlStr2 += "    <th calss="form-group">";
        htmlStr2 += "        <input type="text" name="" class="form-control szhl_require" ms-duplex=" tempmodel.modelData["+dataCount+"].PreTime">";
        htmlStr2 += "    </th>";
        htmlStr2 += "    <th calss="form-group">";
        htmlStr2 += "        <input type="text" name="" class="form-control szhl_form_date_time" ms-duplex=" tempmodel.modelData["+dataCount+"].StartDate" />";
        htmlStr2 += "    </th>";
        htmlStr2 += "    <th calss="form-group">";
        htmlStr2 += "        <input type="text" name="" class="form-control szhl_form_date_time" ms-duplex="tempmodel.modelData["+ dataCount+"].EndDate" />";
        htmlStr2 += "    </th>";
        htmlStr2 += "    <th calss="form-group">";
        htmlStr2 += "        <input type="text" name="" class="form-control" ms-duplex="tempmodel.modelData["+ dataCount+"].ActTime" />";
        htmlStr2 += "    </th>";
        htmlStr2 += "    <th calss="form-group">";
        htmlStr2 += "        <select class="form-control" ms-duplex="tempmodel.[modelData"+dataCount+"].RBWCQK" style="width:100px">";
        htmlStr2 += "            <option></option>";
        htmlStr2 += "            <option></option>";
        htmlStr2 += "            <option  selected = "selected" ></option>";
        htmlStr2 += "        </select>";
        htmlStr2 += "    </th>";
        htmlStr2 += "    <th calss="form-group">";
        htmlStr2 += "        <input type="text" name="" class="form-control" ms-duplex="tempmodel.[modelData"+dataCount+"].BranchName" />";
        htmlStr2 += "    </th>";
        htmlStr2 += "</tr>";
        $("-sharpcontent").append(htmlStr2);
     
    });
The original element of the

page is like this

<tr>
                        <th calss="form-group">
                            <input type="text" name="" class="form-control szhl_require" ms-duplex="modelData[1].PreTime">
                        </th>
                        <th calss="form-group">
                            <input type="text" name="" class="form-control szhl_form_date_time" ms-duplex="modelData[1].StartDate" />
                        </th>
                        <th calss="form-group">
                            <input type="text" name="" class="form-control szhl_form_date_time" ms-duplex="modelData[1].EndDate" />
                        </th>
                        <th calss="form-group">
                            <input type="text" name="" class="form-control" ms-duplex="modelData[1].ActTime" />
                        </th>
                        <th calss="form-group">
                            <select class="form-control" ms-duplex="modelData[1].RBWCQK" style="width:100px">
                                <option></option>
                                <option selected="selected"></option>
                            </select>
                        </th>
                        <th calss="form-group">
                            <input type="text" name="" class="form-control" ms-duplex="modelData[1].BranchName" />
                        </th>
                    </tr>

what result do you expect? What is the error message actually seen?

by calling addLogD, you can also implement two-way binding to modify the content of the page, and update Zhang Hong in the data tempmodel.modelData

.
Jul.09,2021
Menu