Kokombads Ответов: 0

Как привязать курсор мыши к базе данных с помощью нокаута в столбце таблицы


I am trying to bind a column in a table for mouseover event, if the cursor is over the column cell (not the column header), it will make the extended details (StrTimeDesc) visible. But when I run it, it will only display the 1st column (Work Date column) then the rest is blank.

apply bindings are already done. I just omitted those parts because SO doesn't allow a post with a lot of codes and less details. If i remove the mouseover binding, the table runs fine. That mouseover bindings came from knockoutjs site


Что я уже пробовал:

here is my view:
<pre lang="HTML"><table class="table">
    <thead>
        <tr>

            <th>Work Date</th>
            <th>Schedule Description</th>


        </tr>
    </thead>

    <tbody data-bind="foreach: Timesheet_headers">
        <tr>
            <td data-bind="text: workDate"></td>

            <td>
                <div data-bind="event: { mouseover: enableDetails, mouseout: disableDetails }">
                    <span data-bind="text: StrSchedDesc"></span>
                </div>
                <div data-bind="visible: detailsEnabled">
                    <span data-bind="text: StrTimeDesc"></span>
                </div>
            </td>       

        </tr>
    </tbody>
</table>

вот мой нокаут:
var Action =
{

    Timesheet_headers: ko.observableArray([]),
    workDate: ko.Observable(),
    Schedule_description: ko.observable(),
    StrSchedDesc: ko.observable(),
    StrTimeDesc: ko.observable(),

    detailsEnabled: ko.observable(false),
    enableDetails: function() {
        this.detailsEnabled(true);
    },
    disableDetails: function() {
        this.detailsEnabled(false);
    }
}

0 Ответов