searchResultsGrid.uispin.html 1.96 KB
<ui:group 
		let:keyProperties="{= app:getKeyProperties(?type) }"
		let:pagerId="{= ui:uniqueId() }"
		let:tableId="{= ui:uniqueId() }">
	<table id="{= ?tableId }"/>
	<div id="{= ?pagerId }" />
	<script>
		$("#{= ?tableId }").jqGrid({
			<swon:NameValuePair arg:name="url" arg:value="{= fn:concat('getSearchResults?', ?params) }" />,
            <swon:NameValuePair arg:name="datatype" arg:value="json" />,
            colNames:[
                <ui:if ui:condition="{= bound(?keyProperties) }">
             		<ui:forEach ui:resultSet="{# 
             				SELECT ?colName
             				WHERE {
             					GRAPH ui:graph {
             						?keyProperties (rdf:rest*)/rdf:first ?keyProperty .
             						BIND (spif:titleCase(ui:label(?keyProperty)) AS ?colName) .
             					}
             				}
             			}" ui:separator=",">
            			'{= ?colName }'
            		</ui:forEach>
            	</ui:if>
            	<ui:else>
            		'Resource'
            	</ui:else>
            ],
            colModel:[
                <ui:if ui:condition="{= bound(?keyProperties) }">
	         		<ui:forEach ui:resultSet="{# 
		     				SELECT ?varName
		     				WHERE {
		     					GRAPH ui:graph {
		     						?keyProperties (rdf:rest*)/rdf:first ?property .
		     						BIND (app:keyPropertyVarName(?property) AS ?varName) .
		     					}
		     				}
	     				}" ui:separator=",">
	            		{
	            			<swon:NameValuePair arg:name="name" arg:value="{= ?varName }" />
	            		}
	    			</ui:forEach>
	    		</ui:if>
	    		<ui:else>
	                {
	                	name : 'label'
	                }
	    		</ui:else>
            ],
            rowNum: 10,
            rowList:[5,10,20],
            pager: '#{= ?pagerId }',
            viewrecords: true,
            sortorder: "desc",
            height: "100%",
            width: "100%"
        }).jqGrid('navGrid', '#{= ?pagerId }', { add:false, edit:false, del:false});
	</script>
</ui:group>