Skip to content

Commit 0838926

Browse files
authored
Merge pull request #12 from lucasmtav/master
Added method to allow inserting a class in the row
2 parents bc0a57d + 986c1e8 commit 0838926

File tree

8 files changed

+34
-9
lines changed

8 files changed

+34
-9
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ $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+
"classRow": "disabled" || function(row){}, // optional, class on <tr> is possible used calback function(row)
4748
4849
"collumns": [{ // required
4950
"title": "ID", // title of collumn
5051
"index": "id", // Property that will print in the column
51-
"class": "text-center" || function(row){}, // optional, class od <th> and <td> is Possible used calback function(row)
52+
"class": "text-center" || function(row){}, // optional, class od <th> and <td> is Possible used calback function(row)
5253
"style": { // optional
5354
"width": "60px" // It is possible to define some properties in html
5455
}

dist/directive.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* angular-rs-datagrid
33
*
4-
* Version: 1.0.75 - 2018-03-14T18:27:12.792Z
4+
* Version: 1.0.77 - 2018-05-21T17:52:28.365Z
55
* License: MIT
66
*/
77

dist/directive.js

Lines changed: 14 additions & 2 deletions
Large diffs are not rendered by default.

dist/directive.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/directive.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-rs-datagrid",
3-
"version": "1.0.75",
3+
"version": "1.0.77",
44
"description": "Angular directive for dataGrid with pagination in back-end and input, input-mask, chosen, combo, checkbox, multiChosen and others",
55
"repository": "[email protected]:lucrod1/angular-rs-datagrid.git",
66
"main": "dist/directive.css, dist/directive.js",

src/directive-template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ <h3 class="popover-title" ng-if="config.popoverRow.titleRender" ng-bind-html="ge
5757
</tr>
5858
</thead>
5959
<tbody>
60-
<tr ng-if="!showInfoProgress" ng-click="clickRow(row)" ng-mouseover="hoverTr($event, row)" ng-mouseout="outTr()" ng-repeat="row in getCollection() track by $index">
60+
<tr class="{{getClassRow(row)}}" ng-if="!showInfoProgress" ng-click="clickRow(row)" ng-mouseover="hoverTr($event, row)" ng-mouseout="outTr()" ng-repeat="row in getCollection() track by $index">
6161
<td class="{{getClass(collumn, row)}}" ng-click="clickCell($event, row, collumn.index)" ng-style="collumn.style" ng-repeat="collumn in collumns track by $index">
6262
<!-- print html text-->
6363
<div style="display: inline-block;" ng-if="collumn.isHtml && !collumn.action" ng-bind-html-compile="row._internal[collumn.index] | unsafe"></div>

src/directive.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,18 @@ angular.module('rs.datagrid', ['ui.utils.masks', 'ui.select'])
388388
refresh(0);
389389
};
390390

391+
///////////////////////////////////////////////////////////////////////////////////////////////
392+
// VARIABLES AND METHODS FOR SET CLASS IN TR
393+
///////////////////////////////////////////////////////////////////////////////////////////////
394+
395+
scope.getClassRow = function(row) {
396+
if (angular.isFunction(scope.config.classRow)) {
397+
return scope.config.classRow(row);
398+
} else if (scope.config.classRow) {
399+
return scope.config.classRow;
400+
}
401+
};
402+
391403
///////////////////////////////////////////////////////////////////////////////////////////////
392404
// VARIABLES AND METHODS FOR PRINT CONTENT CELL
393405
///////////////////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)