带可编辑文本框的bootgrid

时间:2015-10-18 21:20:12

标签: database textbox jquery-bootgrid

如何在我的BootGrid中添加一个可编辑的文本框和列的文本,以便在其中打开文本框进行编辑,如果我将其更改为移动到下一行或丢失文本框的焦点将导致保存到数据库?

我该怎么做?

1 个答案:

答案 0 :(得分:0)

<table id="grid-keep-selection" class="table table-condensed table-hover table-striped">
    <thead>
        <tr>
            <th data-column-id="order" data-type="numeric" data-identifier="true">#</th>
            <th data-column-id="selected" data-formatter="commands" data-sortable="false">Seçili</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>@i</td>
            </tr>
            i += 1;
        }
    </tbody>
</table>


    $("#grid-keep-selection").bootgrid({
        formatters: {
            "commands": function (column, row) {
                return "<input type=\"number\" class=\"form-control\" name=\"txtSoru\" id=\"txtSoru" + row + "\" value=\"0\" min=\"0\" max=\"" + row + "\" />";
            }
        }
    });