searchResultsGrid.uispin.html 2.33 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="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 list:member ?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 list:member ?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',
	                	width: 400
	                }
	    		</ui:else>
            ],
            <ui:if ui:condition="{= bound(?onSelect) }">
            	onSelectRow: function(resource) {
            		{= ?onSelect }
            	},
            </ui:if>
            autoWidth: true,
            height: '100%',
            rowNum: 10,
            rowList:[5,10,20],
            pager: '#{= ?pagerId }',
            shrinkToFit: false,
            sortorder: 'asc',
            viewrecords: true
            //width: '100%'
        }).jqGrid('navGrid', '#{= ?pagerId }', { 
        	add:false, 
        	del:false, 
        	edit:false, 
        	search: false
        });
		
		$("#{= ?tableId }").parent().resize(function() {
			alert('Resized');
		});
	</script>
</ui:group>