Completed
Branch master (ebb499)
by Alexey
04:15
created

system/modules/Ui/static/js/DataManager.js   F

Complexity

Total Complexity 126
Complexity/F 3

Size

Lines of Code 488
Function Count 42

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
nc 6912
dl 0
loc 488
rs 3.12
c 0
b 0
f 0
wmc 126
mnd 6
bc 120
fnc 42
bpm 2.8571
cpm 3
noi 12

15 Functions

Rating   Name   Duplication   Size   Complexity  
D DataManager.js ➔ DataManager 0 103 11
A DataManager.newCategory 0 5 1
A DataManager.reload 0 3 1
A DataManager.delRow 0 12 2
A DataManager.switchCategory 0 6 1
B inji.Ui.dataManagers.get 0 16 6
A DataManager.delCategory 0 12 2
B DataManager.groupAction 0 54 6
F DataManager.load 0 193 20
A inji.onLoad 0 5 1
A inji.Ui.dataManagers.popUp 0 20 2
B DataManager.flowPanel 0 28 6
A DataManager.newItem 0 9 3
A DataManager.rowSelection 0 9 1
A inji.Ui.dataManagers.reloadAll 0 5 2

How to fix   Complexity   

Complexity

Complex classes like system/modules/Ui/static/js/DataManager.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
/**
2
 * Data Manager objects
3
 * 
4
 * @author Alexey Krupskiy <[email protected]>
5
 * @link http://inji.ru/
6
 * @copyright 2015 Alexey Krupskiy
7
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
8
 */
9
inji.Ui.dataManagers = {
10
  instances: {},
11
  get: function (element) {
12
    if ($(element).hasClass('dataManager')) {
13
      if (typeof (this.instances[$(element).attr('id')]) != 'undefined') {
14
        return this.instances[$(element).attr('id')];
15
      } else {
16
        return this.instances[$(element).attr('id')] = new DataManager($(element));
17
      }
18
    } else {
19
      if ($(element).closest('.dataManager').length == 1 && typeof (this.instances[$(element).closest('.dataManager').attr('id')]) != 'undefined') {
20
        return this.instances[$(element).closest('.dataManager').attr('id')];
21
      } else if ($(element).closest('.dataManager').length == 1) {
22
        return this.instances[$(element).closest('.dataManager').attr('id')] = new DataManager($(element).closest('.dataManager'));
23
      }
24
    }
25
    return null
26
  },
27
  popUp: function (item, params) {
28
    var code = item;
29
30
    if (typeof (params.relation) != 'undefined') {
31
      code += params.relation;
32
    }
33
    code = code.replace(/\:/g, '_').replace(/\\/g, '_');
34
    var modal = inji.Ui.modals.show('', '<div class = "text-center"><img src = "' + inji.options.appRoot + 'static/moduleAsset/Ui/images/ajax-loader.gif" /></div>', code, 'modal-lg');
35
    inji.Server.request({
36
      url: 'ui/dataManager/',
37
      dataType: 'json',
38
      data: {item: item, params: params},
39
      success: function (data) {
40
        modal.find('.modal-body').html(data);
41
        $.each(modal.find('.modal-body .dataManager'), function () {
42
          inji.Ui.dataManagers.instances[$(this).attr('id')] = new DataManager($(this));
43
        });
44
      }
45
    });
46
  },
47
  reloadAll: function () {
48
    for (var key in this.instances) {
0 ignored issues
show
Complexity introduced by
A for in loop automatically includes the property of any prototype object, consider checking the key using hasOwnProperty.

When iterating over the keys of an object, this includes not only the keys of the object, but also keys contained in the prototype of that object. It is generally a best practice to check for these keys specifically:

var someObject;
for (var key in someObject) {
    if ( ! someObject.hasOwnProperty(key)) {
        continue; // Skip keys from the prototype.
    }

    doSomethingWith(key);
}
Loading history...
49
      this.instances[key].reload();
50
    }
51
  }
52
}
53
54
55
56
function DataManager(element) {
57
  this.element = element;
58
  this.params = element.data('params');
59
  this.filters = this.params.filters ? this.params.filters : {};
60
  this.modelName = element.data('modelname');
61
  this.managerName = element.data('managername');
62
  this.options = element.data('options');
63
64
  this.categoryModel = this.options.categorys && this.options.categorys.model ? this.options.categorys.model : '';
65
  this.categoryPath = '/';
66
  this.categoryId = 0;
67
68
  this.limit = 30;
69
  this.page = 1;
70
  this.sortered = {};
71
  this.categoryIndex = '';
72
  this.mode = '';
73
  this.all = 0;
74
  this.ajaxUrl = 'ui/dataManager/loadRows';
75
  if (this.options.ajaxUrl) {
76
    this.ajaxUrl = this.options.ajaxUrl;
77
  }
78
  var instance = this;
79
  $(this.element).find('thead [type="checkbox"],tfoot [type="checkbox"]').click(function () {
80
    var index = $(this).closest('th').index();
81
    if (!this.checked) {
82
      $(instance.element).find('.datamanagertable tbody tr').each(function () {
83
        $($(this).find('td').get(index)).find('[type="checkbox"]')[0].checked = false;
84
      });
85
    } else {
86
      $(instance.element).find('.datamanagertable tbody tr').each(function () {
87
        $($(this).find('td').get(index)).find('[type="checkbox"]')[0].checked = true;
88
      });
89
    }
90
  });
91
  if (this.options.sortMode) {
92
    $(this.element).find('.modeBtn').on('click', function () {
93
      if (instance.mode != $(this).data('mode')) {
94
        instance.mode = $(this).data('mode');
95
        instance.all = 1;
96
        instance.page = 1;
97
        instance.load();
98
      } else {
99
        instance.mode = '';
100
        instance.all = 0;
101
        instance.page = 1;
102
        instance.load();
103
      }
104
    });
105
  }
106
  $(this.element).find('.pagesContainer').on('click', 'a', function () {
107
    instance.page = $(this).attr('href').match(/page\=(\d+)\&?/)[1];
108
    instance.limit = $(this).attr('href').match(/limit\=(\d+)\&?/)[1];
109
    instance.load();
110
    return false;
111
  });
112
  self = this;
0 ignored issues
show
Bug introduced by
The variable self seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.self.
Loading history...
113
  //TODO: miltiple handlers
114
  $(document).on('scroll', function () {
115
    self.flowPanel();
116
  });
117
  //TODO: miltiple handlers
118
  $(window).on('resize', function () {
119
    self.flowPanel();
120
  });
121
  self.flowPanel();
122
123
  if (window.location.hash && window.location.hash != '#') {
124
    var windowsHash = JSON.parse(decodeURIComponent(window.location.hash.substr(1)));
125
    if (windowsHash[this.modelName + ':' + this.managerName]) {
126
      var hashData = windowsHash[this.modelName + ':' + this.managerName];
127
      this.limit = hashData.params.limit;
128
      this.page = hashData.params.page;
129
      this.sortered = hashData.sortered;
130
      this.all = hashData.all;
131
      this.filters = hashData.filters;
132
      if (hashData.filters && this.element.find('.dataManagerFilters [name^="datamanagerFilters"]').length > 0) {
133
        this.element.find('.dataManagerFilters [name^="datamanagerFilters"]').each(function () {
134
          var maths = $(this).attr('name').match(/\[([^\]]+)\]/g);
135
          for (key in maths) {
0 ignored issues
show
Bug introduced by
The variable key seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.key.
Loading history...
136
            maths[key] = maths[key].replace(/([\[\]])/g, '');
137
          }
138
          if (hashData.filters[maths[0]]) {
139
            if (typeof maths[2] != 'undefined') {
140
              $(this).val(hashData.filters[maths[0]][maths[1]][maths[2]]);
141
            } else {
142
              if ($(this).attr('type') == 'checkbox') {
143
                $(this)[0].checked = hashData.filters[maths[0]][maths[1]];
144
              } else {
145
                $(this).val(hashData.filters[maths[0]][maths[1]]);
146
              }
147
            }
148
          }
149
        });
150
      }
151
152
153
      // var data = {params: params, modelName: this.modelName, managerName: this.managerName, filters: filters, sortered: this.sortered, mode: this.mode, all: this.all};
154
    }
155
  }
156
157
  this.load();
158
}
159
160
DataManager.prototype.newItem = function (model, options) {
161
  if (this.categoryId) {
162
    if (!options.preset) {
163
      options.preset = {};
164
    }
165
    options.preset['category_id'] = this.categoryId;
166
  }
167
  inji.Ui.forms.popUp(model, options);
168
}
169
DataManager.prototype.newCategory = function () {
170
  var options = {preset: {}};
171
  options.preset['parent_id'] = this.categoryId;
172
  inji.Ui.forms.popUp(this.categoryModel, options);
173
}
174
DataManager.prototype.delRow = function (key) {
175
  if (confirm('Вы уверены, что хотите удалить элемент?'))
176
  {
177
    inji.Server.request({
178
      url: 'ui/dataManager/delRow',
179
      data: {params: this.params, modelName: this.modelName, key: key, managerName: this.managerName},
180
      success: function () {
181
        inji.Ui.dataManagers.reloadAll();
182
      }
183
    });
184
  }
185
}
186
DataManager.prototype.delCategory = function (key) {
187
  if (confirm('Вы уверены, что хотите удалить элемент?'))
188
  {
189
    inji.Server.request({
190
      url: 'ui/dataManager/delCategory',
191
      data: {params: this.params, modelName: this.modelName, key: key, managerName: this.managerName},
192
      success: function () {
193
        inji.Ui.dataManagers.reloadAll();
194
      }
195
    });
196
  }
197
}
198
DataManager.prototype.reload = function () {
199
  this.load();
200
}
201
DataManager.prototype.load = function (options) {
202
  if ($('#' + this.element.attr('id')).length == 0) {
203
    delete inji.Ui.dataManagers[this.element.attr('id')];
204
    return;
205
  }
206
  var dataManager = this;
207
  if (typeof this.params == 'string') {
208
    var params = JSON.parse(this.params);
209
  }
210
  if (Object.prototype.toString.call(this.params) === '[object Array]') {
211
    var params = {};
212
  } else {
213
    var params = this.params;
214
  }
215
  params.limit = this.limit;
216
  params.page = this.page;
217
  params.categoryPath = this.categoryPath;
218
  filters = this.filters;
0 ignored issues
show
Bug introduced by
The variable filters seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.filters.
Loading history...
219
  if (this.element.find('.dataManagerFilters [name^="datamanagerFilters"]').length > 0) {
220
    this.element.find('.dataManagerFilters [name^="datamanagerFilters"]').each(function () {
221
      var maths = $(this).attr('name').match(/\[([^\]]+)\]/g);
222
      for (key in maths) {
0 ignored issues
show
Bug introduced by
The variable key seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.key.
Loading history...
223
        maths[key] = maths[key].replace(/([\[\]])/g, '');
224
      }
225
      if (!filters[maths[0]]) {
226
        filters[maths[0]] = {};
227
      }
228
      if (typeof maths[2] != 'undefined') {
229
        if (!filters[maths[0]][maths[1]]) {
230
          filters[maths[0]][maths[1]] = {};
231
        }
232
        filters[maths[0]][maths[1]][maths[2]] = $(this).val();
233
      } else {
234
        if ($(this).attr('type') == 'checkbox' && !$(this)[0].checked) {
235
          filters[maths[0]][maths[1]] = 0;
236
        } else {
237
          filters[maths[0]][maths[1]] = $(this).val();
238
        }
239
      }
240
    });
241
  }
242
  if (this.options.sortable) {
243
    for (var key2 in this.options.cols) {
0 ignored issues
show
Complexity introduced by
A for in loop automatically includes the property of any prototype object, consider checking the key using hasOwnProperty.

When iterating over the keys of an object, this includes not only the keys of the object, but also keys contained in the prototype of that object. It is generally a best practice to check for these keys specifically:

var someObject;
for (var key in someObject) {
    if ( ! someObject.hasOwnProperty(key)) {
        continue; // Skip keys from the prototype.
    }

    doSomethingWith(key);
}
Loading history...
244
      var colname;
245
      if (typeof this.options.cols[key2] == 'object') {
246
        colname = key2;
247
      } else {
248
        colname = this.options.cols[key2];
249
      }
250
      if (this.options.sortable.indexOf(colname) == -1) {
251
        continue;
252
      }
253
      var th = $('.' + dataManager.element.attr('id') + '_colname_' + colname.replace(/\:/g, '\\:'));
254
      if (!th.hasClass('sortable')) {
255
        th.html('<a href = "#">' + th.html() + '</a>');
256
        th.addClass('sortable');
257
        if (this.options.preSort && this.options.preSort[colname]) {
258
          if (this.options.preSort[colname] == 'asc') {
259
            th.addClass('sorted-asc');
260
            this.sortered[colname] = 'asc';
261
          } else if (this.options.preSort[colname] == 'desc') {
262
            th.addClass('sorted-desc');
263
            this.sortered[colname] = 'desc';
264
          }
265
        }
266
        //sorted-desc
267
        th.click(function () {
268
          var colname = $(this).data('colname');
269
          $(this).addClass('clickedsort');
270
          dataManager.element.find('.sortable').not('.clickedsort').removeClass('sorted-asc').removeClass('sorted-desc');
271
          $(this).removeClass('clickedsort');
272
          dataManager.sortered = {};
273
          if (!$(this).hasClass('sorted-desc') && !$(this).hasClass('sorted-asc')) {
274
            $(this).addClass('sorted-desc');
275
            dataManager.sortered[colname] = 'desc';
276
            dataManager.reload();
277
          } else if ($(this).hasClass('sorted-desc')) {
278
            $(this).removeClass('sorted-desc');
279
            $(this).addClass('sorted-asc');
280
            dataManager.sortered[colname] = 'asc';
281
            dataManager.reload();
282
          } else if ($(this).hasClass('sorted-asc')) {
283
            $(this).removeClass('sorted-asc');
284
            delete dataManager.sortered[colname];
285
            dataManager.reload();
286
          }
287
          return false;
288
        })
289
      }
290
    }
291
  }
292
  var data = {params: params, modelName: this.modelName, managerName: this.managerName, filters: filters, sortered: this.sortered, mode: this.mode, all: this.all};
293
  if (options && options.download) {
294
    data.download = true;
295
    var url = this.ajaxUrl;
296
    if (url.indexOf(inji.options.appRoot) !== 0) {
297
      url = inji.options.appRoot + url;
298
    }
299
    window.location = url + '?' + $.param(data);
300
    return;
301
  }
302
  dataManager.element.find('.datamanagertable tbody').html('<tr><td colspan="' + dataManager.element.find('thead tr th').length + '"><div class = "text-center"><img src = "' + inji.options.appRoot + 'static/moduleAsset/Ui/images/ajax-loader.gif" /></div></td></tr>');
303
  var instance = this;
304
305
306
  var windowHash = {};
307
  if (window.location.hash && window.location.hash != '#') {
308
    windowHash = JSON.parse(decodeURIComponent(window.location.hash.substr(1)));
309
  }
310
  windowHash[data.modelName + ':' + data.managerName] = data;
311
  window.location.hash = JSON.stringify(windowHash);
312
  inji.Server.request({
313
    url: this.ajaxUrl,
314
    data: data,
315
    success: function (data) {
316
      dataManager.element.find('.datamanagertable tbody').html(data.rows);
317
      dataManager.element.find('.pagesContainer').html(data.pages);
318
319
      if (dataManager.options.options && dataManager.options.options.formOnPage) {
320
        $('.' + dataManager.modelName.replace(/\\/g, '_') + '_' + dataManager.managerName + '_create_btn').each(function () {
321
          var createBtn = $(this);
322
          var btnHref = createBtn.attr('href');
323
          btnHref = btnHref.substr(0, btnHref.indexOf('redirectUrl='));
324
          btnHref += 'redirectUrl=' + window.location.pathname;
325
          createBtn.attr('href', btnHref + '&dataManagerHash=' + window.location.hash.substr(1));
326
        });
327
      }
328
329
      //dataManager.flowPages();
330
      if (dataManager.options.sortMode) {
331
        if (dataManager.mode != 'sort') {
332
          dataManager.element.find('.modeBtn').removeClass('active');
333
        } else {
334
          dataManager.element.find('.modeBtn').addClass('active');
335
        }
336
      }
337
      $(instance.element).find('.datamanagertable tbody').sortable().sortable("disable");
338
      if (dataManager.mode == 'sort') {
339
        $(instance.element).find('.datamanagertable tbody').sortable({
340
          stop: function (event, ui) {
341
            ids = $(instance.element).find('.datamanagertable tbody tr');
0 ignored issues
show
Bug introduced by
The variable ids seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.ids.
Loading history...
342
            i = 0;
0 ignored issues
show
Bug introduced by
The variable i seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.i.
Loading history...
343
            while (ids[i]) {
344
              var key = $($(ids[i++]).find('td').get(1)).text();
345
              inji.Server.request({
346
                url: 'ui/dataManager/updateRow',
347
                data: {params: instance.params, modelName: instance.modelName, key: key, col: 'weight', col_value: i, managerName: instance.managerName, silence: true},
348
              });
349
            }
350
          }
351
        }).sortable("enable");
352
      }
353
      dataManager.flowPanel();
354
    }
355
  });
356
  if (dataManager.element.find('.categoryTree').length > 0) {
357
    dataManager.element.find('.categoryTree').html('<img class ="img-responsive" src = "' + inji.options.appRoot + 'static/moduleAsset/Ui/images/ajax-loader.gif" />');
358
    inji.Server.request({
359
      url: 'ui/dataManager/loadCategorys',
360
      data: {params: params, modelName: this.modelName, managerName: this.managerName},
361
      success: function (data) {
362
        dataManager.element.find('.categoryTree').html(data);
363
        dataManager.element.find('.categoryTree [data-path="' + instance.categoryPath + '"]').parent().addClass('active');
364
        dataManager.element.find('.treeview').treeview();
365
        $(instance.element).find('.categoryTree').sortable().sortable("disable");
366
        if (dataManager.mode == 'sort') {
367
          $(instance.element).find('.categoryTree ul a[data-path]').map(function () {
368
            this.onclick = null
369
          });
370
          $(instance.element).find('.categoryTree ul').sortable({
371
            stop: function (event, ui) {
372
              ids = $(instance.element).find('li');
0 ignored issues
show
Bug introduced by
The variable ids seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.ids.
Loading history...
373
              console.log(instance.element, ids)
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
374
              i = 0;
0 ignored issues
show
Bug introduced by
The variable i seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.i.
Loading history...
375
              while (ids[i]) {
376
                var key = $(ids[i]).find('>a').data('id');
377
                var model = $(ids[i]).find('>a').data('model');
378
                console.log(key, model)
379
                if (key && model) {
380
                  inji.Server.request({
381
                    url: 'ui/dataManager/updateRow',
382
                    data: {params: instance.params, modelName: model, key: key, col: 'weight', col_value: i, managerName: instance.managerName, silence: true},
383
                  });
384
                }
385
                i++;
386
              }
387
            }
388
          }).sortable("enable");
389
        }
390
      }
391
    });
392
  }
393
}
394
DataManager.prototype.switchCategory = function (categoryBtn) {
395
  this.categoryPath = $(categoryBtn).data('path');
396
  this.categoryId = $(categoryBtn).data('id');
397
  this.categoryIndex = $(categoryBtn).data('index');
398
  this.reload();
399
}
400
DataManager.prototype.flowPanel = function () {
401
402
  var managerHeight = $(this.element).height();
403
  var managerTop = $(this.element).offset().top;
404
  var managerBottom = managerTop + managerHeight;
405
406
  var scrollHeight = $(document).scrollTop() + $(window).height();
407
  var floater = $(this.element).find('.dataManager-bottomFloat');
408
409
  if (managerBottom > scrollHeight && managerTop < scrollHeight && scrollHeight < scrollHeight + floater.outerHeight()) {
410
    if (!floater.hasClass('floated')) {
411
      var floaterContainer = $(this.element).find('.dataManager-bottomFloat-container');
412
      floaterContainer.css('height', floater.outerHeight());
413
      floater.css('right', $(window).width() - ($(this.element).offset().left + $(this.element).width()) + 'px');
414
      floater.css('position', 'fixed');
415
      floater.addClass('floated');
416
    }
417
  } else {
418
    if (floater.hasClass('floated')) {
419
      var floaterContainer = $(this.element).find('.dataManager-bottomFloat-container');
420
      floater.css('right', 'auto');
421
      floater.css('position', 'relative');
422
      floater.removeClass('floated');
423
      floaterContainer.css('height', 'auto');
424
    }
425
  }
426
427
}
428
DataManager.prototype.groupAction = function (actionName) {
429
  var ids = '';
430
  var rows = {};
431
  $(this.element).find('.datamanagertable tbody tr').each(function () {
432
    if ($($(this).find('td').get(0)).find('[type="checkbox"]')[0].checked) {
433
      ids += ',' + $($(this).find('td').get(0)).find('[type="checkbox"]').val();
434
      rows[$($(this).find('td').get(0)).find('[type="checkbox"]').val()] = $(this);
435
    }
436
  });
437
  if (ids != '') {
438
    var action = this.options.actions[actionName];
439
    if (action.customJsChecker) {
440
      if (!window[action.customJsChecker](this, rows)) {
441
        return;
442
      }
443
    }
444
    if (action.aditionalInfo) {
445
      var id = inji.randomString();
446
      var html = '<form id ="' + id + '"><h3>Для этой груповой операции требуется дополнительная информация</h3>';
447
      for (key in action.aditionalInfo) {
0 ignored issues
show
Bug introduced by
The variable key seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.key.
Loading history...
448
        var input = action.aditionalInfo[key];
449
        html += '<div class = "form-group"><label>' + input.label + '</label><input type="' + input.type + '" name ="' + key + '" class = "form-control" value = "" /></div>';
450
      }
451
      html += '<div class = "form-group"><button class="btn btn-primary" >' + action.name + '</button></div></form>';
452
      inji.Ui.modals.show('Дополнительная информация', html, 'modal' + id);
453
      var instance = this;
454
      $('#' + id).submit(function () {
455
        $(this).closest('.modal').modal('hide');
456
        var adInfo = {};
457
        if ($(this).find('input').length > 0) {
458
          $.each($(this).find('input'), function () {
459
            adInfo[$(this).attr('name')] = $(this).val();
460
          });
461
        }
462
        inji.Server.request({
463
          url: 'ui/dataManager/groupAction',
464
          data: {params: instance.params, modelName: instance.modelName, ids: ids, managerName: instance.managerName, action: actionName, adInfo: adInfo},
465
          success: function () {
466
            inji.Ui.dataManagers.reloadAll();
467
          }
468
        });
469
        return false;
470
      });
471
    } else {
472
      inji.Server.request({
473
        url: 'ui/dataManager/groupAction',
474
        data: {params: this.params, modelName: this.modelName, ids: ids, managerName: this.managerName, action: actionName},
475
        success: function () {
476
          inji.Ui.dataManagers.reloadAll();
477
        }
478
      });
479
    }
480
  }
481
}
482
DataManager.prototype.rowSelection = function (type) {
483
  $(this.element).find('.datamanagertable tbody tr').each(function () {
484
    if ($($(this).find('td').get(0)).find('[type="checkbox"]')[0].checked && (type == 'unSelectAll' || type == 'inverse')) {
485
      $($(this).find('td').get(0)).find('[type="checkbox"]')[0].checked = false;
486
    } else if (!$($(this).find('td').get(0)).find('[type="checkbox"]')[0].checked && (type == 'selectAll' || type == 'inverse')) {
487
      $($(this).find('td').get(0)).find('[type="checkbox"]')[0].checked = true;
488
    }
489
  });
490
}
491
492
inji.onLoad(function () {
493
  $.each($('.dataManager'), function () {
494
    inji.Ui.dataManagers.instances[$(this).attr('id')] = new DataManager($(this));
495
  });
496
});