1
- # Directive angular-rs-datagrid
1
+ # Directive angular-rs-datagrid
2
2
#### Directive is under development, version beta
3
3
4
4
## Installation
@@ -23,7 +23,7 @@ This component works with two dependencies, angular-input-mask and angular-ui-se
23
23
## How to use
24
24
include module into app
25
25
26
- ```
26
+ ```
27
27
rs.datagrid
28
28
```
29
29
@@ -44,9 +44,9 @@ $scope.config =
44
44
"sumLabel" : "Total: ", // optional, default: "Total: "
45
45
"sort": true, // optional, default: false
46
46
"defaultSort": "id,asc", // optional, default is first "collumn.index", asc
47
-
47
+
48
48
"collumns": [{ // required
49
- "title": "ID", // title of collumn
49
+ "title": "ID", // title of collumn
50
50
"index": "id", // Property that will print in the column
51
51
"class": "text-center" || function(row){}, // optional, class od <th> and <td> is Possible used calback function(row)
52
52
"style": { // optional
@@ -69,7 +69,7 @@ $scope.config =
69
69
{
70
70
...
71
71
"search": {
72
- "label": "Search: " //optional
72
+ "label": "Search: " //optional
73
73
}
74
74
...
75
75
}
@@ -119,7 +119,7 @@ $scope.config =
119
119
{
120
120
...
121
121
"collumns": [{ // required
122
- "title": "Render", // title of collumn
122
+ "title": "Render", // title of collumn
123
123
"index": "name", // Property that will print in the column
124
124
"render": function(row){ // callback for override the output
125
125
return row.id+' - '+row.name;
@@ -128,14 +128,14 @@ $scope.config =
128
128
...
129
129
}
130
130
```
131
- Is possible render html content, for this defines property isHtml
131
+ Is possible render html content, for this defines property isHtml
132
132
133
133
```
134
134
$scope.config =
135
135
{
136
136
...
137
137
"collumns": [{ // required
138
- "title": "Render", // title of collumn
138
+ "title": "Render", // title of collumn
139
139
"index": "name", // Property that will print in the column
140
140
"isHtml": true,
141
141
"render": function(row){ // callback for override the output
@@ -189,7 +189,7 @@ $scope.config =
189
189
...
190
190
"collumns": [
191
191
{
192
- "title": "", // title of collumn
192
+ "title": "", // title of collumn
193
193
"index": "enable", // Property that will print in the column
194
194
"class": "text-center", // optional, class od <th> and <td>
195
195
"sort": false, // optional default: true
@@ -250,7 +250,7 @@ $scope.config =
250
250
"index": "nickName",
251
251
"action": {
252
252
"type": "input",
253
- "class": "input-rs", // optional
253
+ "class": "input-rs", // optional
254
254
"style": { // optional
255
255
"width": "100px"
256
256
},
@@ -263,7 +263,7 @@ $scope.config =
263
263
return false;
264
264
}
265
265
},
266
- "onChange": function(row) { // callback when exec trigger
266
+ "onChange": function(row) { // callback when exec trigger
267
267
console.log('Row actual: '+row);
268
268
}
269
269
}
@@ -285,9 +285,9 @@ $scope.config =
285
285
"action": {
286
286
"type": "input",
287
287
"trigger": "blur", // required, default: 'blur', avaliables Triggers 'blur', 'change'
288
- "mask": {
288
+ "mask": {
289
289
"use": "number", // avaliables uses: 'number', 'money', 'br-phone','br-cep','br-cpf','br-cpfcnpj'
290
- "decimalPlace": 2, // number of decimals
290
+ "decimalPlace": 2, // number of decimals
291
291
"maxlength": 11,
292
292
"negative": true // optional, default false
293
293
},
@@ -298,7 +298,7 @@ $scope.config =
298
298
return false;
299
299
}
300
300
},
301
- "onChange": function(row) { // callback when exec trigger
301
+ "onChange": function(row) { // callback when exec trigger
302
302
console.log("Row actual: "+row);
303
303
}
304
304
}
@@ -314,8 +314,8 @@ $scope.config =
314
314
{
315
315
...
316
316
mask: {
317
- use: 'money',
318
- decimalPlace: 2, // number of decimals
317
+ use: 'money',
318
+ decimalPlace: 2, // number of decimals
319
319
maxlength: 11
320
320
},
321
321
...
@@ -358,7 +358,7 @@ $scope.config =
358
358
mask: {
359
359
use: 'br-cpf'
360
360
},
361
- onChange: function(row, isValid) { //callback
361
+ onChange: function(row, isValid) { //callback
362
362
if(isValid){
363
363
console.log('execute action here');
364
364
}else{
@@ -379,7 +379,7 @@ $scope.config =
379
379
mask: {
380
380
use: 'br-cnpj'
381
381
},
382
- onChange: function(row, isValid) { //callback
382
+ onChange: function(row, isValid) { //callback
383
383
if(isValid){
384
384
console.log('execute action here');
385
385
}else{
@@ -391,7 +391,7 @@ $scope.config =
391
391
```
392
392
393
393
## Mask br-cpfcnpj
394
- Callback has two parameters, row and isValid, isValid is result validation
394
+ Callback has two parameters, row and isValid, isValid is result validation
395
395
396
396
```
397
397
$scope.config =
@@ -400,7 +400,7 @@ $scope.config =
400
400
mask: {
401
401
use: 'br-cpfcnpj'
402
402
},
403
- onChange: function(row, isValid) { //callback
403
+ onChange: function(row, isValid) { //callback
404
404
if(isValid){
405
405
console.log('execute action here');
406
406
}else{
@@ -457,7 +457,7 @@ $scope.config =
457
457
index: 'tag',
458
458
action: {
459
459
type: 'chosen',
460
- placeholder: 'Selecione um tag...',
460
+ placeholder: 'Selecione um tag...',
461
461
class: '', // optional
462
462
style: { // optional
463
463
width: '100px'
@@ -564,18 +564,25 @@ $scope.config =
564
564
collumns: [{...}],
565
565
buttons: [
566
566
{
567
- text: 'Excluir', //optional
567
+ text: 'Excluir', //optional
568
568
classButton: 'btn btn-xs btn-primary', // class ex: <button class="btn btn-xs btn-primary"></button>
569
569
onClick: function(obj) { // callback when clicked
570
570
console.log('Execute action here obj clicked:' + obj.id);
571
571
}
572
572
},
573
573
{
574
- tooltip: 'Tooltip', //optional
574
+ tooltip: 'Tooltip', //optional
575
575
classIcon: 'glyphicon glyphicon-remove', // class for icon in button
576
576
classButton: 'btn btn-xs btn-danger', // class ex: <button class="btn btn-xs btn-danger"></button>
577
- isVisible: function(obj) { // callback for handle when the button will be rendered according a expression boolean
578
- if (obj.id == 1) {
577
+ isVisible: function(obj) { // callback for handle when the button will be rendered according a boolean expression
578
+ if (obj.id == 1) {
579
+ return false;
580
+ } else {
581
+ return true;
582
+ }
583
+ },
584
+ isDisabled: function(obj) { // callback for handle when the button will be disabled according a boolean expression
585
+ if (obj.id == 1) {
579
586
return false;
580
587
} else {
581
588
return true;
@@ -636,15 +643,15 @@ $scope.config =
636
643
labelSize: 'Registros por página: ', // optional, default "Page size: ""
637
644
defaultSize: 10, // optional, default first item in avaliableSizes
638
645
avaliableSizes: [10, 25, 50, 100, 500], // optional, default [10,25,50,100]
639
- positionBottom: true // optional, default is true, position over top
646
+ positionBottom: true // optional, default is true, position over top
640
647
},
641
648
...
642
649
}
643
650
```
644
651
645
652
When using paging, you must implement a lazyData function within the configuration, this function is responsive to update or components automatically, page sorts and other
646
653
647
- ```
654
+ ```
648
655
$scope.config =
649
656
{
650
657
...
0 commit comments