Ng-Grid Reference first column - angularjs

I am using NG-grid to display data in a table. I need to hide certain cells in a row if the 2nd cell in that same row gives back a certain response. I am writing a method that for each cell it will check to see what the value of the 2nd cell in this row is. My problem is I have no idea how to reference the value in that 2nd cell. Is it something like {{row.entity[col.field[1]]}}??? Thanks you

If you have access to the column name, you can use {{row.getProperty(\'columnName\')}}.
You can look at the row templates for an example.

Related

One cell on the same row affects another cell on the table component wen using antd

This is a question, How to implement the feature: One cell on the same row affects another cell.
For Example:
The cell 1 inputted 100, The second cell must less than 100, It means the second cell value must less than the first cell.
How can I implement this feature?
My experience:
All the data store into redux(for example), then check the different cell base on redux data

Insert data in ADF table cell by cell

I am working on ADF application.
I have table and I need to insert data into it cell by cell and column by column in order.
For example:
on start, all cells should be disables except only one cell (the first cell at YearworkDegree column)
if user entered value for that cell it should open below cell.. etc
after finishing YearWorkDegree column it should open first cell from the second column MidtermDegree and so on.
Is there a feature in ADF I can use in that case, or should I think in JavaScript to handle that case.
You can set the properties of one field to be dependent on the other and set partial page refresh between the two - so when you change the value in the first - the second on becomes enabled.
That being said - doing this is going to cause a lot of chattiness to the backend server (on each field change).
So you basically need something like tab navigation between cells but in a different order (downwards). There is no integrated functionality for this in ADF, you have to do it by yourself by writing a custom JS handler.
Please check this example
You can then modify it for your needs (making only the current cell enabled for editing, etc).

uiGrid switch rows and columns

This is a bit of a general question into the possibilities of ui grid. I have had tremendous success with ui grid thus far. Now I have a use case where I want to switch the rows and columns of the grid.
Basically, I would like the headers to be displayed 'vertically' in the first column and to have the rows become columns.
Is this possible with ui grid?
As far as i know UI-grid doesn't support this. I doubt if you can do that. May be try building ColumnsDef and Data dynamically and pass it to gridOptions. Or else add extra column and this should be the first column where you will pass all the header values. Change the background of the cells to look like header cells. Now add second column where you pass the entire first row values. Hide the original header row completely. see now u got your required grid........ :)

ng-grid get column index with row.entity possible?

I am able to access the row.entity object for my drag and drop directives using https://github.com/logicbomb/lvlDragDrop/blob/master/script/lvl-drag-drop.js. I get the row.entity with code like this
angular.element(element).scope().$parent.row.entity
With this code I can see the row's data, but what I need is the column. Basically I can drag and drop an ng-grid cell into any other ng-grid cell, I want to know all the data the row has, as well as the specific cell that was drag/dropped.
I have tried $parent.col, but not sure what else to try.
If you want to show column index
cellTemplate: '{{grid.renderContainers.body.visibleColumnCache.indexOf(col)}}'
Try getting the column data from the row entity. It looks like you may be able to do something like 'row.entity[col.index]'. Try inspecting $parent.row.entity to see what else is stored in there.

Grid not updating upon change in model in angularjs

Folks,
I am using ng-grid to display a list of items.
I want to give my users ability to rearrange the rows in the list.
i.e move the rows up and down as they please.
Now,
However when I update the grid data in the backend i.e say change the index of a particular row, that row does not automatically change locations in the front-end.
What am i missing here ?
I have created a plunker to describe the problem
http://plnkr.co/edit/s1hrTSqF2zeZo3Btaln0
The grid doesn't use the index of the array to order it, so even if you are changing it, because the data is still there nothing happens.
What you could do is define an order field and update the value then changing the values as shown in this plukr. The order field you can hide it from the grid if required using columnDefs to explicitly defined which column should be shown.
Regards

Resources