Skip to content

Instantly share code, notes, and snippets.

@kflaw
Last active December 10, 2015 17:19
Show Gist options
  • Save kflaw/e6e352e0319e738b53ca to your computer and use it in GitHub Desktop.
Save kflaw/e6e352e0319e738b53ca to your computer and use it in GitHub Desktop.
search_ROW.js
/*eslint no-alert: 0*/
define([
'dojo/on',
'dojo/_base/lang',
'dojo/date/locale'
], function (on, lang, locale) {
'use strict';
function formatDateTime (value) {
if (value instanceof Date) {
return locale.format(value, {
formatLength: 'short'
});
}
return '';
}
function formatDate (value) {
if (value instanceof Date) {
return locale.format(value, {
selector: 'date',
formatLength: 'medium'
});
}
return '';
}
function getDateTime (value) {
if (isNaN(value) || value === 0 || value === null) {
return null;
}
return new Date(value);
}
return {
map: true,
mapClickMode: true,
layers: [
{
name: 'Records',
expression: '', // additional where expression applied to all queries
queryParameters: {
type: 'table', // spatial, relationship, table or database
layerID: 'mapSets', // from operational layers
sublayerID: 47,
outFields: ['*']
},
idProperty: 'objectid',
attributeSearches: [
{
name: 'Search For Parcel',
searchFields: [
{
name: 'Parcel',
label: 'Parcel Number',
expression: '(pclprt0 LIKE \'[value]%\')',
placeholder: 'Enter the Parcel Number (min 3 chars)',
required: true,
minChars: 3
}
],
title: 'Parcel Ledger',
topicID: 'parcelLedgerQuery',
// gridOptions: {
// columns: [
// {
// field: 'PDNAME',
// label: 'Name',
// width: 150
// },
// {
// field: 'ADDRESS',
// label: 'Address',
// width: 150
// },
// {
// field: 'PDTYPE',
// label: 'Type',
// width: 100
// },
// {
// field: 'FUNCTION',
// label: 'Function',
// width: 100
// },
// {
// field: 'LASTUPDATE',
// label: 'Last Update',
// width: 100,
// get: function (object) { // allow export as a proper date
// return new Date(object.LASTUPDATE);
// },
// formatter: formatDateTime
// }
// ],
// sort: [
// {
// attribute: 'PDNAME',
// descending: 'ASC'
// }
// ]
// }
}
]
}
]
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment