Angular JS : ng-grid row color - angularjs

I am using ng-grid to show the customer data from database, what i want to do is to give a row color which is alltoted to customer.
for example customer 1 has select red color so all the data related to customer 1 should be in a row with red color. is it possbible?
i have been searching and all i got to know is
rowTemplate
but i dont know if it will fix my dynamic row coloring problem

You can try something like this with ng-class
In your view :
<yourrow ng-class="{'oftheuser': user.id == row.userid}"></yourrow>
In your css :
yourrow.oftheuser{
background-color:red
}
You have to give us some code for a better example :p

Related

PrimeNG p-multiSelect Customize label of selected Items

I'm quite new to Angular and needed help in for a requirements.
The dropdown should have Select All as the option for user to
select all items.
The selectedItemsLabel need to be
dynamically selected to have 2 or 3 selected values as per size and
rest with +{remaining} more label.
I have so far written code like this - Link. Any help would be appreciated.

Limit data based on UniqueCount

I have charts on a tab, that should only show if 1 value from a column filter is selected.
For example if a field named: BUSINESS_UNIT has values of "HR","FIN","IT" The charts should only show data if 1 value is filtered on. Such as "HR."
These charts do not contain the BUSINESS_UNIT field itself.
I tried using the Limit Data Using expression, but for some reason the limit expression UniqueCount(BUSINESS_UNIT)=1 doesn't work.
How would I hide the data in the charts, unless 1 BUSINESS_UNIT is selected?
What you could do is hide the filters panel and create radio buttons on a new text area for each property to mark data. If you need help setting this up let me know. Then in your visualisations limit data using markings and show an empty visualisation if no items are marked.
One downside to this is maintenance, if the values change you will have to update the UI.
Another possible solution (untested) is to change the filter panel properties from checkboxes to radio buttons.
Filter Panel Properties:
http://stn.spotfire.com/spotfire_client_help/filter/filter_panel_properties.htm
You want it to look something like this:
http://stn.spotfire.com/spotfire_client_help/filter/filter_radio_buttons.htm

How to programmatically select a row in Ui.grid angularJs?

I have an issue let me put it simple in my plunker example I want to know why is my $scope.revertSelection() function not working.
http://plnkr.co/edit/3KXrUuCsSACuhefmyzxN?p=info
Steps:
Sort right hand grid by Name(descending order)
Select 3-4 rows randomly
Click 'Copy' button all selected rows are copied into $scope.retainSelection
Sort right hand grid by Name(Ascending order)
Click 'Revert' button (this is not working)
I am expecting all the rows previously selected in step 2) to be selected back which is not happening :-( please help me with the issue.
I googled but could not find any docs of gridApi.selection to look for other methods to fulfill my requirement.
Note: I am using Ui.grid not ng-grid
I should use...
$scope.gridApi.grid.modifyRows($scope.gridOptions.data);
$scope.gridApi.selection.selectRow($scope.gridOptions.data[i]);
...instead of...
$scope.gridApi.selection.selectRow(i);
My friend gave link to docs.

How to add different image with pagination in ng-grid

I have a grid that displays images as values in one of its column using following code.
{
field: 'TR',
displayName: 'Trigger Redundancy',
cellTemplate: '<div class="ngCellText" ng-class="col.colIndex()"><span ng-cell-text><img src="http://goo.gl/aFomAA"></img></span></div>'
}
Now I want few more alterations to my grid which I am unable to do,
Instead displaying one image as value for a column, I want five different images that should be shown on the basis of numeric value from 0-4.
I want to include bootstrap pagination to my grid.
After images are displayed, when I right click on it, it should provide me some functionality using which I could be able to change my image to some different image.
I want 1st column that should provide me a button, by clicking on it I should be able to display information of that row in some textbox below my grid.
I want to apply filtration on three of my columns such that I will provide user a textbox to search whatever he will type in that, that should be filtered from these three columns.
How can I achieve this? Possibly a working example?
I have a working demo Plunker of my grid
I have make chenges to show the images from 0 to 4 based on the data and even for the click function but i think to show some option you should avoid right click and you use left click and if you will make changes to the data source of gird it will automatically display the required value in the grid for showing different images.

How to retrive the selected grid rows inside a panel in controller in extjs

how can i retrive the selected rows from grid inside the panel in controller i tried using itemId but i am getting the null array. I attaching the screenshot of grid. Also i pasting the constoller selection method
Ext.widget('adminRoleView').down('#adminRoleView').getSelectionModel().getSelection();
"adminRoleView" is the alias of the panel and "adminRoleView" is the itemId of the grid which is inside the panel. Also i am new to technology so i dont know whether this wrong or right.
you can use this :
var rows = Ext.getCmp('YOUR_GRID_ID').getSelectionModel().getSelections();
its return all the selected rows.
i got the solution by giving
this.up("panel").down("itemID").getSelectionModel().getSelection();
i think Ext.ComponentMgr is good than above method... :)
Ext.getCmp('adminRoleView').getStore().getSelectionModel().getSelection();

Resources