JQuery模板未将记录集显示为groupby

JQuery模板未将记录集显示为groupby,jquery,jquery-templates,Jquery,Jquery Templates,我尝试了不同的方式来显示标题,它是GroupBy字段,但不显示在网格中。所有的 其他记录在分组中正确显示 有人告诉我怎么修吗 记录现在显示但未填充${Title}占位符 表格记录 {Title} HRDInactive HRD HRDN1 HR HRBDN HRB HRBCDN HRC {Title} Patients

我尝试了不同的方式来显示标题,它是GroupBy字段,但不显示在网格中。所有的 其他记录在分组中正确显示

有人告诉我怎么修吗

记录现在显示但未填充${Title}占位符

表格记录

{Title}
        HRDInactive     HRD     
        HRDN1           HR  
        HRBDN           HRB     
        HRBCDN          HRC     
{Title}
        PatientsCInactive       PatientsC   
        PatientsADN             PatientsA   
        PatientsBDN             PatientsB   
[[{"ParentMenuId":0,"Id":30,"GroupName":"footer_menu","IndexOrder":0,"Title":"Health Resources","DisplayName":"HRDInactive","UrlName":"HRD","Active":false,"Message":null,"Status":null},{"ParentMenuId":0,"Id":27,"GroupName":"footer_menu","IndexOrder":1,"Title":"Health Resources","DisplayName":"HRDN1","UrlName":"HR","Active":true,"Message":null,"Status":null},{"ParentMenuId":0,"Id":28,"GroupName":"footer_menu","IndexOrder":2,"Title":"Health Resources","DisplayName":"HRBDN","UrlName":"HRB","Active":true,"Message":null,"Status":null},{"ParentMenuId":0,"Id":29,"GroupName":"footer_menu","IndexOrder":3,"Title":"Health Resources","DisplayName":"HRBCDN","UrlName":"HRC","Active":true,"Message":null,"Status":null}],[{"ParentMenuId":0,"Id":26,"GroupName":"footer_menu","IndexOrder":1,"Title":"Patients","DisplayName":"PatientsCInactive","UrlName":"PatientsC","Active":false,"Message":null,"Status":null},{"ParentMenuId":0,"Id":24,"GroupName":"footer_menu","IndexOrder":2,"Title":"Patients","DisplayName":"PatientsADN","UrlName":"PatientsA","Active":true,"Message":null,"Status":null},{"ParentMenuId":0,"Id":25,"GroupName":"footer_menu","IndexOrder":3,"Title":"Patients","DisplayName":"PatientsBDN","UrlName":"PatientsB","Active":true,"Message":null,"Status":null}]]
r在Firefox Firebug中响应

{Title}
        HRDInactive     HRD     
        HRDN1           HR  
        HRBDN           HRB     
        HRBCDN          HRC     
{Title}
        PatientsCInactive       PatientsC   
        PatientsADN             PatientsA   
        PatientsBDN             PatientsB   
[[{"ParentMenuId":0,"Id":30,"GroupName":"footer_menu","IndexOrder":0,"Title":"Health Resources","DisplayName":"HRDInactive","UrlName":"HRD","Active":false,"Message":null,"Status":null},{"ParentMenuId":0,"Id":27,"GroupName":"footer_menu","IndexOrder":1,"Title":"Health Resources","DisplayName":"HRDN1","UrlName":"HR","Active":true,"Message":null,"Status":null},{"ParentMenuId":0,"Id":28,"GroupName":"footer_menu","IndexOrder":2,"Title":"Health Resources","DisplayName":"HRBDN","UrlName":"HRB","Active":true,"Message":null,"Status":null},{"ParentMenuId":0,"Id":29,"GroupName":"footer_menu","IndexOrder":3,"Title":"Health Resources","DisplayName":"HRBCDN","UrlName":"HRC","Active":true,"Message":null,"Status":null}],[{"ParentMenuId":0,"Id":26,"GroupName":"footer_menu","IndexOrder":1,"Title":"Patients","DisplayName":"PatientsCInactive","UrlName":"PatientsC","Active":false,"Message":null,"Status":null},{"ParentMenuId":0,"Id":24,"GroupName":"footer_menu","IndexOrder":2,"Title":"Patients","DisplayName":"PatientsADN","UrlName":"PatientsA","Active":true,"Message":null,"Status":null},{"ParentMenuId":0,"Id":25,"GroupName":"footer_menu","IndexOrder":3,"Title":"Patients","DisplayName":"PatientsBDN","UrlName":"PatientsB","Active":true,"Message":null,"Status":null}]]
AJAX调用

var ReloadGrid = (function(){
            $.getJSON("/FooterMenu/GetFooterGrid", function(data) {
                $('#gridTemplate').tmpl(data).appendTo('table.gridTable > tbody');
            });
 });
模板

<script id="gridTemplate" type="text/x-jQuery-tmpl">
    <tr class="gridRow">
        <td class="gridSpan" >${Title}</td>
    </tr>
    {{tmpl($data) "#cellTemplate"}}
</script>
<script id="cellTemplate" type="text/x-jQuery-tmpl">
    <tr class="gridRow">
        <td class="cellTd">${DisplayName}</td>

    </tr>
</script>   


<div class="gridDiv">
<table class="gridTable" cellspacing="0" cellpadding="0">
    <tbody>
        <tr class="gridTitleRow">
            <td class="iconLink widthAuto">Display Name</td>
        </tr>
    </tbody>
</table>
</div>

${Title}
{{tmpl($data)“#cellTemplate”}
${DisplayName}
显示名称

tmpl
函数传递一个数组时,它将为数组中的每个项目执行模板

在您的示例中,gridTemplate被赋予最外层数组中的每个项,实际上是一个项目数组,如:

[{“ParentMenuId”:0,“Id”:30,“GroupName”:“footer_菜单”,“IndexOrder”:0,“Title”:“Health Resources”,“DisplayName”:“HRDInactive”,“UrlName”:“HRD”,“Active”:false,“Message”:null,“Status”:null},{“ParentMenuId”:0,“Id”:27,“GroupName”:“footer_菜单”,“IndexOrder”:1,“Title”:“Health Resources”,“DisplayName”:“HRDN1”,“UrlName”:“HR”,“Active”:true,“Message”:null,“Status”:null},{“ParentMenuId”:0,“Id”:28,“GroupName”:“footer_菜单”,“IndexOrder”:2,“Title”:“Health Resources”,“DisplayName”:“HRBDN”,“UrlName”:“HRB”,“Active”:true,“Message”:null,“Status”:null},{“ParentMenuId”:0,“Id”:29,“GroupName”:“footer_菜单”,“IndexOrder”:3,“Title”:“Health Resources”,“DisplayName”:“HRBCDN”,“UrlName”:“HRC”,“Active”:true,“消息”:null,“状态”:null}]

然后,当您将
$data
传递给cellTemplate时,它正在为上述数组中的每个项目执行模板,这允许您获取实际数据

如果外部数组中每个项目的标题相同,那么我认为您可以执行以下操作:

<td class="gridSpan" >${$data[0].Title}</td>
${$data[0].Title}