只有第一行是必填字段 - 动态表Knockout.js

时间:2017-04-28 17:58:34

标签: javascript css html5 dynamic knockout.js

<table style="margin-left:20px" border="0" class="ledgergrid" width="" cellpadding="1" cellspacing="2">
                                    <tbody>
                                        <tr>
                                            <th>&nbsp;</th>
                                            <th>A. Citation</th>
                                            <th>B. Relevant Finding(s)</th>
                                            <th>C. Overlap of Populations and/or Settings</th>
                                        </tr>
                                        <tbody data-bind="foreach: listCitations"> 
                                        <tr style="background-color:#eeeeee;" >  
                                            <td width="1%">
                                               <button type="button" class="btn-xs" id="delete" data-bind="click: $parent.removeCitation.bind($data), attr: { title: $parent.deleteCitationToolTip }, visible: $parent.lastIndexCitations() > 2"> X </button>
                                                <td width="33%" ><textarea name="citation" class="" style="width:80% !important; height:60px;" data-bind="css: $parent.KCitationCSS, attr: {id: 'citation' + ($index() + 1), title: $parent.citationToolTip}, value: $data.KCitation"></textarea></td>
                                                <td width="33%"><textarea name="relevantFindings" class="" style="width:80% !important; height:60px;" data-bind=" css: $parent.relevantFindingsCSS, attr: {id: 'relevantFindings' + ($index() + 1), title: $parent.relevantFindingsToolTip}, value: $data.KRelevantFindings"></textarea></td>
                                                <td width="33%"><textarea name="overlapofPopulations" class="" style="width:80% !important; height:60px;" data-bind=" css: $parent.overlapofPopulationsCSS, attr: {id: 'overlapofPopulations' + ($index() + 1), title: $parent.overlapofPopulationsToolTip}, value: $data.KOverlapofPopulations"></textarea></td>
                                        </tr>

                                    </tbody>
                      </table>

我在默认情况下显示了4行,但所有这些都显示为必需。我想只需要第一行,其余的不是必需的。仅供参考,所有桌子都是动态的!提前致谢!

1 个答案:

答案 0 :(得分:0)

你的意思是说按钮后面的第一列?从共享的代码中,我只能看到一行。我假设它的第一列(A.引用)是必需的并且需要特殊外观&amp;感觉。如果是,这是CSS代码:

.ledgergrid td:nth-child(2) {
        background-color:red;
}