mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-31 15:42:59 +00:00 
			
		
		
		
	Real Estate Demo: Add support for computed columns
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -2,19 +2,22 @@ title: $:/plugins/tiddlywiki/geospatial/demo/real-estate-demo | |||||||
| caption: Real Estate Demo | caption: Real Estate Demo | ||||||
| tags: $:/tags/GeospatialDemo | tags: $:/tags/GeospatialDemo | ||||||
|  |  | ||||||
|  | \define default-display-filter() [<currentTiddler>get<fieldname>] | ||||||
|  | \define default-limit() 10 | ||||||
|  |  | ||||||
| This is a list of all the tiddlers containing ~GeoJSON markers in this wiki (identified by the tag <<tag "$:/tags/GeoMarker">>) viewed as both a map and a table. | This is a list of all the tiddlers containing ~GeoJSON markers in this wiki (identified by the tag <<tag "$:/tags/GeoMarker">>) viewed as both a map and a table. | ||||||
|  |  | ||||||
| <$let | <$let | ||||||
| 	schema={{$:/plugins/tiddlywiki/geospatial/demo/real-estate-demo/schema}} | 	schema={{$:/plugins/tiddlywiki/geospatial/demo/real-estate-demo/schema}} | ||||||
| > | > | ||||||
| 	<div> | 	<div> | ||||||
| 		<$list filter="[<schema>jsonindexes[fields]]" variable="index"> | 		<$list filter="[<schema>jsonindexes[columns]]" variable="index"> | ||||||
| 			<$let | 			<$let | ||||||
| 				config={{{ [<schema>jsonget[fields],<index>,[name]addprefix[$:/config/geospatial/demo/real-estate-demo/fields/]] }}} | 				config={{{ [<schema>jsonget[columns],<index>,[name]addprefix[$:/config/geospatial/demo/real-estate-demo/columns/]] }}} | ||||||
| 			> | 			> | ||||||
| 				<div> | 				<div> | ||||||
| 					<$checkbox tiddler=<<config>> field="visible" checked="yes" unchecked="no" default="yes"> | 					<$checkbox tiddler=<<config>> field="visible" checked="yes" unchecked="no" default="yes"> | ||||||
| 						<$text text={{{ [<schema>jsonget[fields],<index>,[caption]] }}}/> | 						<$text text={{{ [<schema>jsonget[columns],<index>,[caption]] }}}/> | ||||||
| 					</$checkbox> | 					</$checkbox> | ||||||
| 				</div> | 				</div> | ||||||
| 			</$let> | 			</$let> | ||||||
| @@ -23,9 +26,9 @@ This is a list of all the tiddlers containing ~GeoJSON markers in this wiki (ide | |||||||
| 	<div> | 	<div> | ||||||
| 		Sorting by | 		Sorting by | ||||||
| 		<$select tiddler="$:/config/geospatial/demo/real-estate-demo/sort-field" default="title"> | 		<$select tiddler="$:/config/geospatial/demo/real-estate-demo/sort-field" default="title"> | ||||||
| 			<$list filter="[<schema>jsonindexes[fields]]" variable="index"> | 			<$list filter="[<schema>jsonindexes[columns]]" variable="index"> | ||||||
| 				<option value={{{ [<schema>jsonget[fields],<index>,[name]] }}}> | 				<option value={{{ [<schema>jsonget[columns],<index>,[name]] }}}> | ||||||
| 					<$text text={{{ [<schema>jsonget[fields],<index>,[caption]] }}}/> | 					<$text text={{{ [<schema>jsonget[columns],<index>,[caption]] }}}/> | ||||||
| 				</option> | 				</option> | ||||||
| 			</$list> | 			</$list> | ||||||
| 		</$select> | 		</$select> | ||||||
| @@ -42,13 +45,13 @@ This is a list of all the tiddlers containing ~GeoJSON markers in this wiki (ide | |||||||
| 	<table> | 	<table> | ||||||
| 		<thead> | 		<thead> | ||||||
| 			<tr> | 			<tr> | ||||||
| 				<$list filter="[<schema>jsonindexes[fields]]" variable="index"> | 				<$list filter="[<schema>jsonindexes[columns]]" variable="index"> | ||||||
| 					<$let | 					<$let | ||||||
| 						config={{{ [<schema>jsonget[fields],<index>,[name]addprefix[$:/config/geospatial/demo/real-estate-demo/fields/]] }}} | 						config={{{ [<schema>jsonget[columns],<index>,[name]addprefix[$:/config/geospatial/demo/real-estate-demo/columns/]] }}} | ||||||
| 					> | 					> | ||||||
| 						<$list filter="[<config>get[visible]else[yes]match[yes]]" variable="ignore"> | 						<$list filter="[<config>get[visible]else[yes]match[yes]]" variable="ignore"> | ||||||
| 							<th> | 							<th> | ||||||
| 								<$text text={{{ [<schema>jsonget[fields],<index>,[caption]] }}}/> | 								<$text text={{{ [<schema>jsonget[columns],<index>,[caption]] }}}/> | ||||||
| 							</th> | 							</th> | ||||||
| 						</$list> | 						</$list> | ||||||
| 					</$let> | 					</$let> | ||||||
| @@ -59,26 +62,36 @@ This is a list of all the tiddlers containing ~GeoJSON markers in this wiki (ide | |||||||
| 			<$let | 			<$let | ||||||
| 				sortField={{{ [[$:/config/geospatial/demo/real-estate-demo/sort-field]get[text]else[title]] }}} | 				sortField={{{ [[$:/config/geospatial/demo/real-estate-demo/sort-field]get[text]else[title]] }}} | ||||||
| 				sortOrder={{{ [[$:/config/geospatial/demo/real-estate-demo/sort-order]get[text]else[normal]] }}} | 				sortOrder={{{ [[$:/config/geospatial/demo/real-estate-demo/sort-order]get[text]else[normal]] }}} | ||||||
| 				limit={{{ [[$:/config/geospatial/demo/real-estate-demo/limit]get[text]else[100]] }}} | 				limit={{{ [[$:/config/geospatial/demo/real-estate-demo/limit]get[text]] :else[<default-limit>] }}} | ||||||
| 			> | 			> | ||||||
| 				<$list filter="[all[shadows+tiddlers]tag[$:/tags/GeoMarker]search:*{$:/config/geospatial/demo/real-estate-demo/search}nsort<sortField>order<sortOrder>limit<limit>]"> | 				<$list filter="[all[shadows+tiddlers]tag[$:/tags/GeoMarker]search:*{$:/config/geospatial/demo/real-estate-demo/search}nsort<sortField>order<sortOrder>limit<limit>]"> | ||||||
| 					<tr> | 					<$let | ||||||
| 						<$list filter="[<schema>jsonindexes[fields]]" variable="index"> | 						rowTiddler=<<currentTiddler>> | ||||||
| 							<$let | 					> | ||||||
| 								config={{{ [<schema>jsonget[fields],<index>,[name]addprefix[$:/config/geospatial/demo/real-estate-demo/fields/]] }}} | 						<$setmultiplevariables | ||||||
| 							> | 							$names="[<schema>jsonindexes[variables]sort[]]" | ||||||
| 								<$list filter="[<config>get[visible]else[yes]match[yes]]" variable="ignore"> | 							$values="[<schema>jsonindexes[variables]sort[]] :map[<schema>jsonget[variables],<currentTiddler>] :map[subfilter<currentTiddler>]" | ||||||
| 									<td> | 						> | ||||||
| 										<$let | 							<tr> | ||||||
| 											fieldname={{{ [<schema>jsonget[fields],<index>,[name]] }}} | 								<$list filter="[<schema>jsonindexes[columns]]" variable="index"> | ||||||
| 										> | 									<$let | ||||||
| 											<$text text={{{ [<currentTiddler>get<fieldname>] }}}/> | 										config={{{ [<schema>jsonget[columns],<index>,[name]addprefix[$:/config/geospatial/demo/real-estate-demo/columns/]] }}} | ||||||
| 										</$let> | 									> | ||||||
| 									</td> | 										<$list filter="[<config>get[visible]else[yes]match[yes]]" variable="ignore"> | ||||||
|  | 											<td> | ||||||
|  | 												<$let | ||||||
|  | 													fieldname={{{ [<schema>jsonget[columns],<index>,[name]] }}} | ||||||
|  | 													displayFilter={{{ [<schema>jsonget[columns],<index>,[display]] :else[<default-display-filter>] }}} | ||||||
|  | 												> | ||||||
|  | 													<$text text={{{ [subfilter<displayFilter>] }}}/> | ||||||
|  | 												</$let> | ||||||
|  | 											</td> | ||||||
|  | 										</$list> | ||||||
|  | 									</$let> | ||||||
| 								</$list> | 								</$list> | ||||||
| 							</$let> | 							</tr> | ||||||
| 						</$list> | 						</$setmultiplevariables> | ||||||
| 					</tr> | 					</$let> | ||||||
| 				</$list> | 				</$list> | ||||||
| 			</$let> | 			</$let> | ||||||
| 		</tbody> | 		</tbody> | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| { | { | ||||||
| 	"fields": [ | 	"columns": [ | ||||||
| 		{"name": "address", "caption": "Address", "type": "string"}, | 		{"name": "address", "caption": "Address", "type": "string"}, | ||||||
| 		{"name": "broker", "caption": "Broker", "type": "string"}, | 		{"name": "broker", "caption": "Broker", "type": "string"}, | ||||||
| 		{"name": "city", "caption": "City", "type": "string"}, | 		{"name": "city", "caption": "City", "type": "string"}, | ||||||
| @@ -9,6 +9,12 @@ | |||||||
| 		{"name": "salesagent", "caption": "Sales Agent", "type": "string"}, | 		{"name": "salesagent", "caption": "Sales Agent", "type": "string"}, | ||||||
| 		{"name": "state", "caption": "State", "type": "string"}, | 		{"name": "state", "caption": "State", "type": "string"}, | ||||||
| 		{"name": "title", "caption": "Title", "type": "string"}, | 		{"name": "title", "caption": "Title", "type": "string"}, | ||||||
| 		{"name": "zipcode", "caption": "Zip Code", "type": "string"} | 		{"name": "zipcode", "caption": "Zip Code", "type": "string"}, | ||||||
| 	] | 		{"name": "census-province", "caption": "Census Province", "type": "string", "display": "[<census-data>jsonget[0],[prov_name_en],[0]]"}, | ||||||
|  | 		{"name": "census-division", "caption": "Census Division", "type": "string", "display": "[<census-data>jsonget[0],[cd_name_en],[0]]"}, | ||||||
|  | 		{"name": "census-subdivision", "caption": "Census Subdivision", "type": "string", "display": "[<census-data>jsonget[0],[csd_name_en],[0]]"} | ||||||
|  | 	], | ||||||
|  | 	"variables": { | ||||||
|  | 		"census-data": "[<rowTiddler>] :map[geopoint{!!long},{!!lat}geolookup{$:/plugins/geospatial/demo/features/canada-census-subdivision-millesime}]" | ||||||
|  | 	} | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jeremy@jermolene.com
					jeremy@jermolene.com