searchResultsGrid.uispin.html 1.93 KB
<ui:group 
		let:keyProperties="{= app:getKeyProperties(?type) }"
		let:pagerId="{= ui:uniqueId() }"
		let:tableId="{= ui:uniqueId() }">
	<table id="{= ?tableId }" style="width: 100%"/>
	<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:[
                'Resource'
                <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>
            ],
            colModel:[
                {
                	name : 'result',
                	width: 200
                }
                <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>
            ],
            rowNum: 10,
            rowList:[5,10,20],
            pager: '#{= ?pagerId }',
            viewrecords: true,
            sortorder: "desc",
            height: "100%",
            width: "500"
        }).jqGrid('navGrid', '#{= ?pagerId }', { add:false, edit:false, del:false});
	</script>
</ui:group>