EXTJS - Cannot set value in record in GridColumn renderer - extjs

I am trying to implement the 'Sum' feature on a grid panel. The fields that are to be summed are calculated dynamically. I tried setting the record inside the renderer. It seems to be working but i see this exception in developer tools.
Cannot read property 'attributes' of null
Reason i think the underlying record is not changed even though the renderer changes the display with its return.
Fiddle: https://fiddle.sencha.com/#view/editor&fiddle/2d2r
Line: 192
To reproduce, please click "increase" in the "Increase or Decrease" dropdown.
Thank you!

Related

Celleditor setting value is not fine in Firefox

I'am designing an application in Extjs4.2 where one grid is there with cellediting plugin. My requirement is on cell click combobox should be displayed. When no data there for combobox in chrome its fine but in FF the element is displaying.
For a better clarity am attaching the screenshot below
Any help is highly appreciated
Thanks in Advance
This might happen, when you didn't specify this columns's dataIndex field in model. Also you need to initialize that field with some value, at least empty string.

How to dynamically update grid cell color and tool tip based on user action in Extjs 4?

Based on a user action, like click of a button, we need to update a grid cell and modify its background color and tool-tip.
Please note that it has to be only a particular cell of grid record and not the entire column affecting all the records.
Thus, how can we update these two things for a particular grid record cell - background color and tool-tip - dynamically?
Thanks for help in advance.
PS: ExtJs version 4.1.1
I have been able to find a solution for this. Though, not sure if its the best way, but posting it here as it may help someone looking for the same.
The solution is to write custom renderer function for the column which needs to be updated and calling the following code on the user action at which the update is required (like in the handler of the button clicked):
grid.getView().refresh();
The above code will invoke the column renderer function and this renderer function should be able to judge which background color and tool-tip to be applied at the grid column as per the current state of application.
Hope this helps.

ExtJS4 gridPanel data not showing

I've made this very simple jsfiddle to show you this abnormal behaviour http://jsfiddle.net/mrgamer/GgUkE/2/
In my application i'm using the same methods i've written here, .loadRawData() on the store, cause .loadData() doesn't fire the 'load' event.
I'm filling the store manually cause i've to filter some JSON data, compile it, and then insert to this store.
Anyway the problem doesn't seem to be in the store, since the Grid gets populated, you can click on 2 rows, but the data isn't displayed!
Updated
There was a typo in the dataIndex properties in your columns. Required a capital 'I'
Grid Panel with Store example
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.Panel
Fixed code
http://jsfiddle.net/fw3Vc/1/

ExtJS 4 - How to avoid grid column value becoming null when column editor is combo-box?

I have a column in a grid with editor as combo-box.
When the grid is loaded then all the column values get displayed properly.
The issue is, when user clicks at the column (having combobox as editor) to edit it then the column value becomes null as shown in the attached screenshot.
I understand that the value becomes null as the store of combobox has not been loaded yet.
I can not use autoLoad true due to the heavy amount of data present in the combobox store. Moreover, even if I use autoLoad:true for the store with paging in it, then that too safeguards only those values which are present in the first page and not all.
Thus, how can I maintain the value in grid column when that value is not present in the store of combobox used as editor for the column?
Could anyone guide at this?
PS: I am using ExtJS Ver 4.0.2a
I have been able to find a solution for this.
It has more to do with the version of ExtJs. If we upgrade to 4.0.7 and then use forceSelection:false for a combobox then things work fine as expected. That is, the combo-box accepts a value which doesn't exist in its store and doesn't set the current value to null.
Hope this helps someone else too looking for something similar.
I would suggest having the grid record contain both that columns value, as well as display value. If the combo store lookup is unable to find a matching value (because that combo store hasn't been loaded yet), then revert to showing the display value stored with the grid record.
You might also need to have the afteredit event on the grid update that grid records display value after that column is edited for a particular row.

How do I refresh Winforms DataGridView?

I have two DataGridViews in a tab and the DataSource of the second grid is based on the row selection in first grid. The problem is I cannot get the grid to refresh after some values have been inserted or updated in the prior tabs. It works fine if I click on the row but it is not working if I select the row programmatically (i.e. first row). I have tried the following but it failed to refresh.
daProgram.ClearBeforeFill = true
daProgram.fill(dsProgram)
bsProgram.ResetBindings(true) -- binding source also tried false
dgvProgram.DataSource=bsProgram -- rebinding the control
I also tried:
dgvProgram.DataSource=nothing
and
dgvProgram.DataBindings.clear()
Nothing works :-(
I would really appreciate if anyone could help me out in this.
Are you binding your data properly?
http://www.theserverside.net/discussions/thread.tss?thread_id=31014
http://bytes.com/groups/net-c/256204-refresh-databindings-winform
I have read a few things about this, and too found ResetBindings not to work.
If you're using Table Adapters, just call the fill method (the method that auto gets added in to your Form Load event).
I've read things that say you shouldn't call Fill. I see no reason why not. It simply re-queries the data, which is exactly what a refresh should do.
Me.YourTableAdapter.Fill(Me.YourDataSet.YourDataTable)
Try This
dgvProgram.DataSource=null;

Resources