1
1
define ( [
2
2
'dojo/on' ,
3
+ 'dojo/_base/lang' ,
3
4
'dojo/date/locale'
4
- ] , function ( on , locale ) {
5
+ ] , function ( on , lang , locale ) {
5
6
6
7
function formatDateTime ( value ) {
7
- var date = new Date ( value ) ;
8
- return locale . format ( date , {
9
- formatLength : 'short'
10
- } ) ;
8
+ if ( value instanceof Date ) {
9
+ return locale . format ( value , {
10
+ formatLength : 'short'
11
+ } ) ;
12
+ }
13
+ return '' ;
11
14
}
12
15
13
16
function formatDate ( value ) {
14
- var date = new Date ( value ) ;
15
- return locale . format ( date , {
16
- selector : 'date' ,
17
- formatLength : 'medium'
18
- } ) ;
17
+ if ( value instanceof Date ) {
18
+ return locale . format ( value , {
19
+ selector : 'date' ,
20
+ formatLength : 'medium'
21
+ } ) ;
22
+ }
23
+ return '' ;
24
+ }
25
+
26
+ function getDateTime ( value ) {
27
+ if ( isNaN ( value ) || value === 0 || value === null ) {
28
+ return null ;
29
+ }
30
+ return new Date ( value ) ;
19
31
}
20
32
21
33
return {
@@ -67,7 +79,7 @@ define([
67
79
label : 'Inspected' ,
68
80
width : 150 ,
69
81
get : function ( object ) { // allow export as a proper date
70
- return new Date ( object . inspdate ) ;
82
+ return getDateTime ( object . inspdate ) ;
71
83
} ,
72
84
formatter : formatDateTime
73
85
} ,
@@ -91,7 +103,7 @@ define([
91
103
field : 'lastupdate' ,
92
104
label : 'Updated' ,
93
105
get : function ( object ) { // allow export as a proper date
94
- return new Date ( object . lastupdate ) ;
106
+ return getDateTime ( object . lastupdate ) ;
95
107
} ,
96
108
formatter : formatDateTime
97
109
}
@@ -123,7 +135,7 @@ define([
123
135
{
124
136
name : 'Hospital Name' ,
125
137
label : 'Name' ,
126
- expression : '(NAME LIKE \'[value]%\')' ,
138
+ expression : '(NAME LIKE \'% [value]%\')' ,
127
139
placeholder : 'Enter the name of the hospital' ,
128
140
required : true ,
129
141
minChars : 3
@@ -150,7 +162,7 @@ define([
150
162
id : 'Action' ,
151
163
field : 'OBJECTID' ,
152
164
label : 'Action' ,
153
- width : 32 ,
165
+ width : 60 ,
154
166
sortable : false ,
155
167
exportable : false ,
156
168
renderCell : function ( object , value , node ) {
@@ -162,8 +174,7 @@ define([
162
174
} ,
163
175
{
164
176
field : 'NAME' ,
165
- label : 'Name' ,
166
- width : 150
177
+ label : 'Name'
167
178
} ,
168
179
{
169
180
field : 'ADDRESS' ,
@@ -183,7 +194,7 @@ define([
183
194
{
184
195
field : 'ZIPCODE' ,
185
196
label : 'Zip Code' ,
186
- width : 80
197
+ width : 100
187
198
} ,
188
199
{
189
200
field : 'TOTALADM' ,
@@ -193,9 +204,9 @@ define([
193
204
{
194
205
field : 'LASTUPDATE' ,
195
206
label : 'Last Update' ,
196
- width : 100 ,
207
+ width : 120 ,
197
208
get : function ( object ) { // allow export as a proper date
198
- return new Date ( object . LASTUPDATE ) ;
209
+ return getDateTime ( object . LASTUPDATE ) ;
199
210
} ,
200
211
formatter : formatDateTime
201
212
}
0 commit comments