comparison src/djol/IdentifyItem.js @ 10:8705103f074f

Слияние
author cin
date Mon, 21 Aug 2017 18:03:00 +0300
parents f0035923ff3e
children
comparison
equal deleted inserted replaced
9:37e9e6bbe87a 10:8705103f074f
1 define([
2 'dijit/_WidgetBase',
3 'dijit/_TemplatedMixin',
4 "dijit/Tooltip",
5 "dojo/_base/declare",
6 "dojo/date/locale",
7 "dojo/dom-construct",
8 "dojo/on" ], function(_WidgetBase, _TemplatedMixin, Tooltip, declare,
9 dateLocale, domConstruct, on) {
10 var empty = {};
11 return declare([ _WidgetBase, _TemplatedMixin ], {
12
13 callback : null,
14
15 dateLocale : dateLocale,
16
17 baseClass : 'identify-item',
18
19 feature : null,
20
21 model : empty,
22
23 title : null,
24
25 templateString : "<div class='identify-item'></div>",
26
27 constructor : function(options) {
28 option = options || {};
29 if (options.title)
30 this.title = options.title;
31 if (options.model)
32 this.model = options.model;
33 if (options.callback)
34 this.callback = options.callback;
35
36 },
37
38 /**
39 * Метод из widget.lifecycle
40 */
41 postCreate : function() {
42 var me = this;
43
44 var content = me.title instanceof Function ? me.title(me)
45 : me.title;
46
47 if (typeof content == "string") {
48 me.domNode.innerHTML = content;
49 } else if (content && content.placeAt) {
50 content.placeAt(me.domNode, "only");
51 } else {
52 domConstruct.place(content, me.domNode, "only");
53 }
54
55 on(me.domNode, "click", function() {
56 if (typeof me.callback == "function") {
57 me.callback(me.model);
58 }
59 });
60 },
61 });
62 });