How to enable SingleClickEdit in ag-grid - angularjs

I am using ag-grid with angularJS. I need to enable the edit options in the table by doing a single click. Now its happening with double click. Can any one please tell me how to do that?

No worries. I added
singleClickEdit: true
in the place where i define the coldefs and rowdata stuffs.

If adding singleClickEdit: true doesn't allow you to edit,
then in addition make sure the column which you are trying to edit has
editable: true
or use defaultColDef and set to your grid:
defaultColDef contains the properties that is inherited by all columns.
defaultColDef: {
flex: 1,
minWidth: 100,
editable: true,
},

Related

AngularJs : style a column in Ag-grid

I want to style a column in ag-grid, using AngularJs (I want it to look like hyperlinks, maybe even with visited/unvisited colo(u)rs). The particular style is not important; I just want to know how to style a column. Static styling is fine; I don't need dynamic styling.
How do I do it?
columnDefs: [{ headerName: "Candidate",
field: "candidate_name",
sortable: true,
cellStyle: function(params) {return {color: 'red'}}},
I am unsure how to do it without the callback, but I can live with this.

checkcolumn grid cell border conditional change in accordance to disable-enable state in sencha 6.0.2

I have a grid with two checkcolumns (apart from the rest columns) and I want to make conditional change of cell (adding specific CSS: making thicker borders of this cell if checkcolumn is enabled and default look if it is disabled) in accordance to disable / enable state.
Unfortunately with using Renderer function I end up with strange outcome (displayed object text or true/false values) because of override native Renderer of checkcolumn I presume. Overwriting checkcolumn renderer is also bad practice which I'm not allowed to do.
I've also tried to use listeners like beforeactivate, beforeDisable etc but they seems not being called whenever state of cell change (disabled <> enabled). I thing that it is possible that its because of using specific bind property as seen bellow.
Is there any method to do it clear (without to much of code repetition and without overriding and adding new method to checkcolumn renderer)??
here is code for one of two checkcolumns in my grid:
{
localized: {
text:
'details.tabview.coordination.icccoordination.changepositions.main.view.ebv'
},
dataIndex: 'ebv',
width: 50,
bind: {
disabled: '{!changeContextEditMode.active}'
},
sortable: true,
filter: true,
xtype: 'checkcolumn',
listeners: {
beforecheckchange: 'checkIfCheckChangePossible'
}
}
I will appreciate any help

ExtJS DateField gets blanked out when selected

I have a grid with a Column configured like...
{
...
editor:new Ext.form.DateField({format:'m/d/Y'}),
renderer: function (val){return val ? Ext.util.Format.date(val, 'm/d/Y') : ''}
...
}
It works fine, except that when I click on a cell to edit it, the cell gets blanked out rather than maintaining its existing value until I choose new one. If after clicking the cell I click away from it, the cell is left empty.
Any idea what would cause this?
Thanks
I would have thought you'd want your column defined like this:
columns: [{
xtype: 'datecolumn',
format: 'm/d/Y',
editor: {
xtype: 'datefield'
}
}]
I don't think you need to use a renderer or use create are you are using it in your example
I've had a similar problem, and solved it somewhat with setting allowBlank: false, as below:
...
editor:new Ext.form.DateField({
format:'m/d/Y',
allowBlank: false
}),
...
This should reset the value back to its original value if you click out of the datefield without selecting a new value.

How to change value for checkcolumn in grid

I got grid with columns:
...
columns: [
{
xtype: 'rownumberer'
}, {
xtype: 'checkcolumn',
sortable: false,
header: 'done',
dataIndex: 'status',
flex: 2,
width: 55,
callback: function(success, model) {
this.setRawValue(success); // DOESNT WORK
this.setValue(success); // DOESNT WORK
},
}
...
I would like to change checkbox state to checked or unchecked. Functions setValue() or setRawValue() have no effect for the checkbox - moreover - there are not available for
the widget.
Is there simple function like setChecked(boolean) in extjs for checkcolumn?
It is ridiculous I have instance 'checkcolumn' but I can't find basic function.
I will be glad for any hint. Thank you.
Bogus
for record in grid store with 'fieldName' checkcolumn write
record.set('fieldName',false)
or
record.set('fieldName',true)
it make field selected/deselected
the most simple way is to do it in the store , you can add a new boolean field in the store with default of true to do that , and later just change that boolean in the store and the grid will be reflected with the changes

Extjs 4 FiltersFeature vs stateful grid

I have a grid with some columns with filters.
columns defination:
columns:[{
text: "Number",
dataIndex: 'clientreference',
width: 200,
filter: true,
sortable: true
},
here is filter feature defination
features: [{
ftype: 'filters',
encode: true,
local: false
}],
The problem is: When i'm trying to save state of grid, filters are not working: When I adding this code to a grid:
stateful: true,
stateId: 'documentsGrid',
I refresh the page and all works fine, because i dont have state in my cookies.
But when I refresh the page second time - state loads from cookies and filters are not working.
If i remove stateful: true and refresh page, filters are working fine.
Any suggestions?
Also I noticed, that all examples in extjs site are only with filters or with stateful grid, but there is no one example with both.
UPDATED:
The most useful way was making my own method for saving state of elements I need and to restore it.
I think you are specifying features in grid.But you can specify filters in store directly.So try to define filters in store and stateful in grid config options.Hope you may get the solution to come out from this.

Resources