newly added rows cannot be drag dropped in extjs gridpanel - extjs

I have a problem with extjs gridpanel dragdrop.
the scenario is as follows:
The gridpanel is initially rendered by loading a remote store.
Then, the rows are added, updated dynamically.
Drag drop feature is implemented on "render" event of gridpanel.
Drag drop works fine for the originally retrieved rows from the remote store.
but when i try to use drag drop for the newly added or edited rows, it doesn't work.
I am getting the following error on firebug:
Index or size is negative or greater than the allowed amount" code: "1
This is may be because , the newly added rows are not taken as a part of the store . I tried changing the event to "click" but it doesnt work that way..
Please please suggest a solution for this fast.. Its needed urgently.
Thanks,
Shreya.

I know 2 methods for drag and drop in ext, one of them is only for grid rows, the other one that I'm using is with setting dragzones and dropzones. With that method, the only thing you have to do is catch an event which is fired when you add new rows to the grid. In that event, set every new row to be a dragzone (so it can be dragged). That's what I did in a similar situation. Hope this helps..
By the way grid rows don't have a .el (DOM element attached to the Ext component, which is the row in this case). So you'll have to create a div for each row component and then use the initializeDropZone(row[x]), where row[x] is the new added row.

Related

AgGrid loose edit mode when data is updated

I use AgGrid Enterprise, and allow users to edit an entire row so all cells switch to edit mode.
I also have an event listener to save the row in database when the user put the focus on a new line or outside the grid.
In the first column of my grid, i have a custom cell displaying a combo.
When the user select a value, it should update the cell AND 3 other cells in the row.
So i use the API to refresh the 3 cells.
Doing so put the cell in view mode, i loose the edit mode and the save event is triggered.
Is there a way in edit mode, to update cell content without loosing the edit mode ??
Thanks a lot.
You said your are try to entire row and and also have custom cell with combo
but ag-grid does not work any popup editor with full row edit.
You have to remove ag-grid property editType: 'fullRow' and it will work.
https://www.ag-grid.com/javascript-grid-cell-editing/#gsc.tab=0

selectionChange or ItemClick

I am designing an extjs application where I have couple of panels. and one of them of has a grid. I know I can either do selectionChange on the grid listener or itemClick.
Which one should I use? Or moreover which one is better. I obviously load data on the right panel once the grid item is clicked
The first one get fired only when the selection changes (as you might has guessed) and give you a array of selected record (which might be just one) while the second one get called for each click and give you only the one record you clicked on.
For your case I would tend to use the second event and save the last last clicked record internally. I would then only load the second grid if it was not already loaded for this record.
your grid is displayed as table on page at runtime so you can add onClick() event on grid or table cell during onrowdatabount event of grid.

ExtJS 2.x Grid Cell Validation for Duplicate Data

I have ExtJS Grid In which I have Columns called "Mobile Number".
I have made simple thing here When I edit more than 2 rows and If I Modify the Column "Mobile Number" It will be checked whether is it Exist in Grid or Not.
If Duplicate Number found, I will give Message that the Input Mobile Number is already Exist and
reloading the whole grid so all edited data will be gone.
But, I want the non-duplicate data back was edited.
So, How can I keep my non-duplicate data as it is after reload the whole Grid.
I just want to remove duplicate row where found duplication and other edited rows keep as it is.
Can I use this RowEditor plugin for ExtJS 2.x compatible.
http://dev.sencha.com/deploy/ext-3.4.0/examples/grid/row-editor.html
My E-mail: ashwin.parmar2020#gmail.com
To find duplicate data use afteredit event of Ext.grid.EditorGridPanel on that event you will get current record, so just display message and add empty value in that field
You should use a validator for the mobile number field that detects duplicates and refuse the duplicate number. So you don't have to reload the grid.
If you want to reload the grid anyways, you could get the dirty rows before doing so and store/reapply them afterwards.
To get the dirty records you can use the getModifiedRecords() function of the grids store. Use the commitChangesfunction of the store to apply them after validation/processing.

rowdeselect event can't fire to save data when it is in last row in Extjs EditorGridPanel

I am using EditorGridPanel with cellEditor which acts nearly like Excel. We implemented Arrow Keys to move among rows and
columns. We do row validation when user moves from one row to another (specifically in rowdeselect event) and then save the
record. There is some issues are:
For the last row of the grid, rowdeselect event does not fire, as we do not have any other control after the grid.
rowdeselect event fires if we move from row to row using Tab, Enter & Arrow keys. But when user clicks on another row using mouse - events do not come in correct sequence, so focus moves to the new row, but earlier row not saved. Currently we solved this by calling stopEditing at the beginning of rowdeselect event.
We would like to know how we can solve these two issues and whether there are more robust ways to handle automatic grid saving.
You can fill free to check the problem in our site. -> http://www.softworksbd.com/swazilandlmis/yyyy_stockdata.php
1 ) First of all the event is not firing on the blur of the whole grid and not just the last row. try changing a row and clicking anywhere on the screen but the grid and you will see that no validation takes place (which means your rowdselect does not fire).
You should try and add a blue event to the whole grid that runs your validation scripts.
2) As far as I have checked the event is fired even on another row click so please explain exactly what you mean...
ps
I have viewed only this page in your application:

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