尽管xEditable被设置为其他值,但它仅提供文本框

时间:2013-05-17 16:44:19

标签: jquery jquery-ui x-editable

在我正在开发的项目中,我在数据库中动态生成一个手风琴值下拉列表,我目前在生成的下拉列表中使用xEditable进行就地编辑值。但是,无论我使用什么方法设置输入类型(内联html元素或jQuery设置),它们总是显示为文本框输入。

代码在这里:

    message.append($('<span />').addClass('').append($('<strong />').addClass('title').html('Project Name: '))
            .append($('<a />').editable().attr("data-pk", projects.ID).attr("data-type", "text")
            .attr("data-name", "ProjectName").attr("data-url", "/ReportServlet")
            .attr("href", "#").html(projects.ProjectName))).append($('<br />'));;
    message.append($('<span />').addClass('').append($('<strong />').addClass('title').html('Infrastructure PM: '))
            .append($('<a />').editable().attr("data-pk", projects.ID).attr("data-type", "text")
            .attr("data-name", "InfraPM").attr("data-url", "/ReportServlet")
            .attr("href", "#").html(projects.InfraPM))).append($('<br />'));;
    message.append($('<span />').addClass('').append($('<strong />').addClass('title').html('Clarity ID: '))
            .append($('<a />').editable().attr("data-pk", projects.ID).attr("data-type", "text")
            .attr("data-name", "ClarityID").attr("data-url", "/ReportServlet")
            .attr("href", "#").html(projects.ClarityID))).append($('<br />'));;
    message.append($('<span />').addClass('').append($('<strong />').addClass('title').html('Project Health: '))
            .append($('<a />').editable().attr("data-pk", projects.ID).attr("data-type", "select")
            .attr("data-name", "ProjectHealth").attr("data-url", "/ReportServlet")
            .attr("data-source", [{value: 0, text: 'Green'}, {value: 1, text: 'Yellow'}, {value: 2, text: 'Red'}])
            .attr("href", "#").html(
                (projects.ProjectHealth == 0) ? '<pre class="green">Green</pre>'
                : (projects.ProjectHealth == 1) ? '<pre class="yellow">Yellow</pre>'
                : (projects.ProjectHealth == 2) ? '<pre class="red">Red</pre>' : "")));
    message.append($('<span />').addClass('').append($('<strong />').addClass('title').html('Project Status: '))
            .append($('<a />').editable().attr("data-pk", projects.ID).attr("data-type", "textarea")
            .attr("data-name", "ProjectStatus").attr("data-url", "/ReportServlet").attr("data-rows", 5)
            .attr("href", "#").html(projects.ProjectStatus))).append($('<br />'));
    message.append($('<span />').addClass('').append($('<strong />').addClass('title').html('Project Schedule: '))
            .append($('<a />').editable().attr("data-pk", projects.ID).attr("data-type", "textarea")
            .attr("data-name", "ProjectSchedule").attr("data-url", "/ReportServlet").attr("data-rows", 5)
            .attr("href", "#").html(projects.ProjectSchedule))).append($('<br />'));;
    message.append($('<span />').addClass('').append($('<strong />').addClass('title').html('Project Hours--DBA: '))
            .append($('<a />').editable().attr("data-pk", projects.ID).attr("data-type", "text")
            .attr("data-name", "ProjectHoursDBA").attr("data-url", "/ReportServlet")
            .attr("href", "#").html(projects.ProjectHoursDBA))).append($('<br />'));;
    message.append($('<span />').addClass('').append($('<strong />').addClass('title').html('Project Hours--Infra: '))
            .append($('<a />').editable().attr("data-pk", projects.ID).attr("data-type", "text")
            .attr("data-name", "ProjectHoursInfra").attr("data-url", "/ReportServlet")
            .attr("href", "#").html(projects.ProjectHoursInfra))).append($('<br />'));;
    message.append($('<span />').addClass('').append($('<strong />').addClass('title').html('Project Hours--PM: '))
            .append($('<a />').editable().attr("data-pk", projects.ID).attr("data-type", "text")
            .attr("data-name", "ProjectHoursPM").attr("data-url", "/ReportServlet")
            .attr("href", "#").html(projects.ProjectHoursPM))).append($('<br />'));;
    message.append($('<span />').addClass('').append($('<strong />').addClass('title').html('Project Completion Date: '))
            .append($('<a />').editable().attr("data-pk", projects.ID).attr("data-type", "datetime")
            .attr("data-name", "ProjectCompletionDate").attr("data-url", "/ReportServlet")
            .attr("href", "#").html(date)));

0 个答案:

没有答案