Skip to content

Commit 8981030

Browse files
authored
Merge pull request #10 from weslley39/master
isDisabled feature added
2 parents 6fda400 + 812bff5 commit 8981030

File tree

8 files changed

+404
-348
lines changed

8 files changed

+404
-348
lines changed

README.md

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Directive angular-rs-datagrid
1+
# Directive angular-rs-datagrid
22
#### Directive is under development, version beta
33

44
## Installation
@@ -23,7 +23,7 @@ This component works with two dependencies, angular-input-mask and angular-ui-se
2323
## How to use
2424
include module into app
2525

26-
```
26+
```
2727
rs.datagrid
2828
```
2929

@@ -44,9 +44,9 @@ $scope.config =
4444
"sumLabel" : "Total: ", // optional, default: "Total: "
4545
"sort": true, // optional, default: false
4646
"defaultSort": "id,asc", // optional, default is first "collumn.index", asc
47-
47+
4848
"collumns": [{ // required
49-
"title": "ID", // title of collumn
49+
"title": "ID", // title of collumn
5050
"index": "id", // Property that will print in the column
5151
"class": "text-center" || function(row){}, // optional, class od <th> and <td> is Possible used calback function(row)
5252
"style": { // optional
@@ -69,7 +69,7 @@ $scope.config =
6969
{
7070
...
7171
"search": {
72-
"label": "Search: " //optional
72+
"label": "Search: " //optional
7373
}
7474
...
7575
}
@@ -119,7 +119,7 @@ $scope.config =
119119
{
120120
...
121121
"collumns": [{ // required
122-
"title": "Render", // title of collumn
122+
"title": "Render", // title of collumn
123123
"index": "name", // Property that will print in the column
124124
"render": function(row){ // callback for override the output
125125
return row.id+' - '+row.name;
@@ -128,14 +128,14 @@ $scope.config =
128128
...
129129
}
130130
```
131-
Is possible render html content, for this defines property isHtml
131+
Is possible render html content, for this defines property isHtml
132132

133133
```
134134
$scope.config =
135135
{
136136
...
137137
"collumns": [{ // required
138-
"title": "Render", // title of collumn
138+
"title": "Render", // title of collumn
139139
"index": "name", // Property that will print in the column
140140
   "isHtml": true,
141141
"render": function(row){ // callback for override the output
@@ -189,7 +189,7 @@ $scope.config =
189189
...
190190
"collumns": [
191191
{
192-
"title": "", // title of collumn
192+
"title": "", // title of collumn
193193
"index": "enable", // Property that will print in the column
194194
"class": "text-center", // optional, class od <th> and <td>
195195
"sort": false, // optional default: true
@@ -250,7 +250,7 @@ $scope.config =
250250
"index": "nickName",
251251
"action": {
252252
"type": "input",
253-
"class": "input-rs", // optional
253+
"class": "input-rs", // optional
254254
"style": { // optional
255255
"width": "100px"
256256
},
@@ -263,7 +263,7 @@ $scope.config =
263263
return false;
264264
}
265265
},
266-
"onChange": function(row) { // callback when exec trigger
266+
"onChange": function(row) { // callback when exec trigger
267267
console.log('Row actual: '+row);
268268
}
269269
}
@@ -285,9 +285,9 @@ $scope.config =
285285
"action": {
286286
"type": "input",
287287
"trigger": "blur", // required, default: 'blur', avaliables Triggers 'blur', 'change'
288-
"mask": {
288+
"mask": {
289289
"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
291291
"maxlength": 11,
292292
"negative": true // optional, default false
293293
},
@@ -298,7 +298,7 @@ $scope.config =
298298
return false;
299299
}
300300
},
301-
"onChange": function(row) { // callback when exec trigger
301+
"onChange": function(row) { // callback when exec trigger
302302
console.log("Row actual: "+row);
303303
}
304304
}
@@ -314,8 +314,8 @@ $scope.config =
314314
{
315315
...
316316
mask: {
317-
use: 'money',
318-
decimalPlace: 2, // number of decimals
317+
use: 'money',
318+
decimalPlace: 2, // number of decimals
319319
maxlength: 11
320320
},
321321
...
@@ -358,7 +358,7 @@ $scope.config =
358358
mask: {
359359
use: 'br-cpf'
360360
},
361-
onChange: function(row, isValid) { //callback
361+
onChange: function(row, isValid) { //callback
362362
if(isValid){
363363
   console.log('execute action here');
364364
}else{
@@ -379,7 +379,7 @@ $scope.config =
379379
mask: {
380380
use: 'br-cnpj'
381381
},
382-
onChange: function(row, isValid) { //callback
382+
onChange: function(row, isValid) { //callback
383383
if(isValid){
384384
   console.log('execute action here');
385385
}else{
@@ -391,7 +391,7 @@ $scope.config =
391391
```
392392

393393
## 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
395395

396396
```
397397
$scope.config =
@@ -400,7 +400,7 @@ $scope.config =
400400
mask: {
401401
use: 'br-cpfcnpj'
402402
},
403-
onChange: function(row, isValid) { //callback
403+
onChange: function(row, isValid) { //callback
404404
if(isValid){
405405
   console.log('execute action here');
406406
}else{
@@ -457,7 +457,7 @@ $scope.config =
457457
index: 'tag',
458458
action: {
459459
type: 'chosen',
460-
placeholder: 'Selecione um tag...',
460+
placeholder: 'Selecione um tag...',
461461
class: '', // optional
462462
style: { // optional
463463
width: '100px'
@@ -564,18 +564,25 @@ $scope.config =
564564
collumns: [{...}],
565565
buttons: [
566566
{
567-
text: 'Excluir', //optional
567+
text: 'Excluir', //optional
568568
classButton: 'btn btn-xs btn-primary',       // class ex: <button class="btn btn-xs btn-primary"></button>
569569
onClick: function(obj) { // callback when clicked
570570
console.log('Execute action here obj clicked:' + obj.id);
571571
}
572572
},
573573
{
574-
tooltip: 'Tooltip', //optional
574+
tooltip: 'Tooltip', //optional
575575
classIcon: 'glyphicon glyphicon-remove', // class for icon in button
576576
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) {
579586
return false;
580587
} else {
581588
return true;
@@ -636,15 +643,15 @@ $scope.config =
636643
labelSize: 'Registros por página: ', // optional, default "Page size: ""
637644
defaultSize: 10, // optional, default first item in avaliableSizes
638645
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
640647
},
641648
...
642649
}
643650
```
644651

645652
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
646653

647-
```
654+
```
648655
$scope.config =
649656
{
650657
...

0 commit comments

Comments
 (0)