jqgrid_utils 1.0.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/jqgrid_utils.js +55 -6
- package/jqgrid_utils.js +55 -6
- package/package.json +2 -1
package/dist/jqgrid_utils.js
CHANGED
|
@@ -4,8 +4,18 @@
|
|
|
4
4
|
module.exports = class Vanilla_website_utils
|
|
5
5
|
{
|
|
6
6
|
|
|
7
|
-
constructor()
|
|
8
|
-
{
|
|
7
|
+
constructor(settings=false)
|
|
8
|
+
{
|
|
9
|
+
if(settings)
|
|
10
|
+
{
|
|
11
|
+
if(settings.hasOwnProperty('page'))
|
|
12
|
+
{
|
|
13
|
+
this.page = settings['page'];
|
|
14
|
+
localStorage.setItem('page', this.page);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
9
19
|
|
|
10
20
|
s_grid_set_captain(_grid, data=[])
|
|
11
21
|
{
|
|
@@ -14,18 +24,57 @@ module.exports = class Vanilla_website_utils
|
|
|
14
24
|
async grid_set_captain(_grid, data=[])
|
|
15
25
|
{
|
|
16
26
|
const grid = jQuery(_grid);
|
|
17
|
-
|
|
27
|
+
let count = 0;
|
|
28
|
+
if(data.length === 0)
|
|
18
29
|
{
|
|
19
|
-
|
|
30
|
+
count = grid.jqGrid('getGridParam', 'records');
|
|
31
|
+
}
|
|
32
|
+
else
|
|
33
|
+
{
|
|
34
|
+
count = data.length;
|
|
20
35
|
}
|
|
21
36
|
let caption = grid.jqGrid("getGridParam", "caption");
|
|
22
|
-
if
|
|
37
|
+
if(caption.indexOf(count+'x') === -1 )
|
|
23
38
|
{
|
|
24
|
-
grid.jqGrid('setCaption', caption + ' - ' +
|
|
39
|
+
grid.jqGrid('setCaption', caption + ' - ' + count + 'x');
|
|
25
40
|
}
|
|
26
41
|
}
|
|
27
42
|
|
|
28
43
|
|
|
44
|
+
s_resize_saved_cell_width(col_model, page=false, grid=false)
|
|
45
|
+
{
|
|
46
|
+
this.grid_set_captain(col_model, page, grid);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async resize_saved_cell_width(col_model,page=false, grid=false)
|
|
50
|
+
{
|
|
51
|
+
let key = page ? page : this.page;
|
|
52
|
+
key += grid ? '-' + grid + '-w-' : '-grid-w-';
|
|
53
|
+
for(let x = 0; x<= col_model.length; x++)
|
|
54
|
+
{
|
|
55
|
+
const width = localStorage.getItem(key + x);
|
|
56
|
+
if(width)
|
|
57
|
+
{
|
|
58
|
+
col_model[x]['width'] = width;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return col_model;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
resize_cell(width, index, _page=false)
|
|
66
|
+
{
|
|
67
|
+
const page = _page ? _page : localStorage.getItem('page');
|
|
68
|
+
const grid = this.id;
|
|
69
|
+
let idx = index-1;
|
|
70
|
+
let key = page + '-' + grid + '-w-' + idx;
|
|
71
|
+
localStorage.setItem(key, width);
|
|
72
|
+
const cat = localStorage.getItem(key);
|
|
73
|
+
console.log(key);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
29
78
|
};
|
|
30
79
|
|
|
31
80
|
|
package/jqgrid_utils.js
CHANGED
|
@@ -3,8 +3,18 @@
|
|
|
3
3
|
module.exports = class Vanilla_website_utils
|
|
4
4
|
{
|
|
5
5
|
|
|
6
|
-
constructor()
|
|
7
|
-
{
|
|
6
|
+
constructor(settings=false)
|
|
7
|
+
{
|
|
8
|
+
if(settings)
|
|
9
|
+
{
|
|
10
|
+
if(settings.hasOwnProperty('page'))
|
|
11
|
+
{
|
|
12
|
+
this.page = settings['page'];
|
|
13
|
+
localStorage.setItem('page', this.page);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
8
18
|
|
|
9
19
|
s_grid_set_captain(_grid, data=[])
|
|
10
20
|
{
|
|
@@ -13,18 +23,57 @@ module.exports = class Vanilla_website_utils
|
|
|
13
23
|
async grid_set_captain(_grid, data=[])
|
|
14
24
|
{
|
|
15
25
|
const grid = jQuery(_grid);
|
|
16
|
-
|
|
26
|
+
let count = 0;
|
|
27
|
+
if(data.length === 0)
|
|
17
28
|
{
|
|
18
|
-
|
|
29
|
+
count = grid.jqGrid('getGridParam', 'records');
|
|
30
|
+
}
|
|
31
|
+
else
|
|
32
|
+
{
|
|
33
|
+
count = data.length;
|
|
19
34
|
}
|
|
20
35
|
let caption = grid.jqGrid("getGridParam", "caption");
|
|
21
|
-
if
|
|
36
|
+
if(caption.indexOf(count+'x') === -1 )
|
|
22
37
|
{
|
|
23
|
-
grid.jqGrid('setCaption', caption + ' - ' +
|
|
38
|
+
grid.jqGrid('setCaption', caption + ' - ' + count + 'x');
|
|
24
39
|
}
|
|
25
40
|
}
|
|
26
41
|
|
|
27
42
|
|
|
43
|
+
s_resize_saved_cell_width(col_model, page=false, grid=false)
|
|
44
|
+
{
|
|
45
|
+
this.grid_set_captain(col_model, page, grid);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async resize_saved_cell_width(col_model,page=false, grid=false)
|
|
49
|
+
{
|
|
50
|
+
let key = page ? page : this.page;
|
|
51
|
+
key += grid ? '-' + grid + '-w-' : '-grid-w-';
|
|
52
|
+
for(let x = 0; x<= col_model.length; x++)
|
|
53
|
+
{
|
|
54
|
+
const width = localStorage.getItem(key + x);
|
|
55
|
+
if(width)
|
|
56
|
+
{
|
|
57
|
+
col_model[x]['width'] = width;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return col_model;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
resize_cell(width, index, _page=false)
|
|
65
|
+
{
|
|
66
|
+
const page = _page ? _page : localStorage.getItem('page');
|
|
67
|
+
const grid = this.id;
|
|
68
|
+
let idx = index-1;
|
|
69
|
+
let key = page + '-' + grid + '-w-' + idx;
|
|
70
|
+
localStorage.setItem(key, width);
|
|
71
|
+
const cat = localStorage.getItem(key);
|
|
72
|
+
console.log(key);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
28
77
|
};
|
|
29
78
|
|
|
30
79
|
|
package/package.json
CHANGED