paginationPageSize only parent level - angularjs

I have an ui-grid options as follows
$scope.gridOptionsCreateTask = {
paginationPageSize:20,
enableColumnMenus: false,
useExternalSorting: false,
resizable: true,
enablePaginationControls: false,
enableRowSelection: true,
enableSelectAll: true,
showTreeExpandNoChildren: true,
rowHeight: 32,
it limit 20 item
But when click expand item 19.
Item 20 it was pushed next page
i need item 20 still one page
i try many property. it don't work

Related

ERROR: b.forEach is not a function with uigrid [Angular]

I am making a grid in AngularJS with Angular UI Grid and the console printing this error:
error: b.forEach is not a function
Does anyone know what is happening?
vm.detalleVirtuales.paginationOptions = {pageNumber: 1, pageSize: 500, sort: null};
vm.detalleVirtuales = {
enableFiltering: true,
enableGridMenu: true,
enableSelectAll: true,
showGridFooter: true,
paginationPageSizes: [500, 1000, 3000, 5000],
paginationPageSize: 500,
useExternalPagination: true,
columnDefs: columDefo,
useExternalSorting: true,
enableFiltering: true,
enableGridMenu: true,
enableSelectAll: true,
enableColumnMenus: true,
exporterCsvFilename: "Detalle_virtuales.csv",
exporterExcelFilename: 'Detalle_virtuales.xlsx',
exporterExcelSheetName: 'Detalle_virtuales',
exporterOlderExcelCompatibility: true,
showColumnFooter: true

Batch of windowed masks with unique positions in vectorized way - Python / NumPy

I need to create stochastic boolean masks for a set of images. Each mask is an array of 1s with 6 random squares, in which the values are 0. The length of the squares are 56 pixels. The mask can be created with the following code:
mask = np.ones(shape=(3, h, w))
for _ in range(6):
x_coordinate = np.random.randint(0, w)
y_coordinate = np.random.randint(0, h)
mask[:, x_coordinate: x_coordinate + 56, y_coordinate: y_coordinate + 56] = 0
Now the tricky thing that I want to do is vectorize this process for a batch of images. Is this even possible? Right now, I'm just calling this function using a simple for-loop for each image in my batch, but I was wondering if there was a way to avoid the for-loop altogether.
ALSO: the mask must be different for each image in the batch (can't use the same mask for each image)
We can leverage np.lib.stride_tricks.as_strided based scikit-image's view_as_windows to get sliding windows and hence solve our case here. More info on use of as_strided based view_as_windows.
Being views-based, it would be as efficient as it can get!
from skimage.util.shape import view_as_windows
N = 3 # number of images in the batch
image_H,image_W = 5,7 # edit to image height, width
bbox_H,bbox_W = 2,3 # edit to window height, width to be set as 0s
w_off = image_W-bbox_W+1
h_off = image_H-bbox_H+1
M = w_off*h_off
R,C = np.unravel_index(np.random.choice(M, size=N, replace=False), (h_off, w_off))
mask_out = np.ones(shape=(N, image_H, image_W), dtype=bool)
win = view_as_windows(mask_out, (1, bbox_H,bbox_W))[...,0,:,:]
win[np.arange(len(R)),R,C] = 0
If you don't mind duplicate masks, simply use replace=True in the code.
Sample output with given input parameters -
In [6]: mask_out
Out[6]:
array([[[ True, True, True, True, True, True, True],
[ True, True, False, False, False, True, True],
[ True, True, False, False, False, True, True],
[ True, True, True, True, True, True, True],
[ True, True, True, True, True, True, True]],
[[ True, True, True, True, True, True, True],
[ True, False, False, False, True, True, True],
[ True, False, False, False, True, True, True],
[ True, True, True, True, True, True, True],
[ True, True, True, True, True, True, True]],
[[ True, True, True, True, True, True, True],
[ True, True, True, True, True, True, True],
[False, False, False, True, True, True, True],
[False, False, False, True, True, True, True],
[ True, True, True, True, True, True, True]]])

Angular UI Grid column filter is not working

I am using Angular js UI grid for table.
Although, everything showing perfect, textbox filter for specific column is not visible to me even after applied !!
My Code :
$scope.gridOptions = {
enableRowSelection: true,
enableRowHeaderSelection: false,
enableColumnMenus: false,
showGridFooter: false,
paginationPageSizes: [10, 20, 30],
paginationPageSize: 10,
paginationOptions: $scope.pagingOptions,
useExternalPagination: false,
multiSelect: false,
enableSorting: true,
enableFiltering: true,
modifierKeysToMultiSelect: false,
noUnselect: false,
enableVerticalScrollbar: true,
enableHorizontalScrollbar: true,
columnDefs: [
{
field: 'name',
displayName: 'UserName',
width: 150,
cellTooltip: true,
CellTemplate: '<div class="GridRow">{{row.name}}</div>',
headerCellTemplate: '<div style="margin: 22px 0px 0px 0px;" ><span class="ui-grid-cell-contents GridHead">Last Run By</span></div>',
cellClass:'tooltipclass',
enableCellEdit: true,
enableFiltering: true
},
]}
Added enablefiltering but its still not showing textbox filter and neither it give any warning or error.
Anyone have any input on if I am missing something over here ?
Thank you very much
The textbox for filtering is not visible because you are providing a headerCellTemplate for that column. See here: Angular UI Grid - Custom Header Template and Filtering. Another solution would be to copy the predefined template of headerCell from ui-grid into your code and modify it as per your requirements.

ng-grid grouping - Can I group rows in a grid based on a condition?

I am trying to group a row based on a condition. I have 2 columns in my table, User and group.
If the value of group is blank, I want to keep those rows ungrouped.
Trying to achieve this grouping
Right now the rows are also grouped for the rows where group value is blank.
Current grouping which I have acheived
Below is my grid, I have marked my column Group as a grouping.
$scope.gridOptionsUserGroup = {
enableFiltering: true,
enableColumnResizing: true,
resize:false,
enableSorting: true,
enableColumnMenus: false,
enableSelectAll: true,
enableRowSelection: true,
enableFullRowSelection:true,
enableRowHeaderSelection:true,
enableGroupHeaderSelection: true,
multiSelect: true,
enableGridMenu: true,
showGroupPanel: true,
rowHeight: 30,
groups: ['grouping'],
columnDefs: [{ field: 'grouping', displayName: 'Group' ,grouping: { groupPriority: 0 },
sort: { priority: 1, direction: 'asc' }},
{ field: 'userName', displayName: 'User Name' }
],
};

how to remove hide column option in angular?

ui-grid in my demo .here is the api document
http://ui-grid.info/docs/#/tutorial/101_intro
I want to remove hide option from the columns .In each columns there is "V" image and on click of that image it show hide column option.I want to remove that option .how it is possible
here is my code
self.gridOptions = {
enableFiltering: true,
enableRowSelection: true,
multiSelect: false,
enableRowHeaderSelection: false,
enableSorting: false
};
http://plnkr.co/edit/ye0HXTbKv6dDYTQ0DMyX?p=preview
The page you're after is here: http://ui-grid.info/docs/#/tutorial/303_customizing_column_menu
You can remove the menu on each column header completely using:
enableColumnMenus: false
In your grid options as so:
self.gridOptions = {
enableFiltering: true,
enableRowSelection: true,
multiSelect: false,
enableRowHeaderSelection: false,
enableSorting: false,
enableColumnMenus: false
};
You can hide column menu by using colDef."enableColumnMenu":false
self.gridOptions.columnDefs=[ { field: 'name' },
{ field: 'gender' },
{ field: 'company',
enableSorting: true,
enableColumnMenu :false }]

Resources