I have two grid-panels to drag from grid1 and drop on grid2, and a reset button with this handler function:
handler: function(){
//refresh source grid
Ext.getCmp('grid1').getStore().load();
//purge destination grid
Ext.getCmp('grid2').removeAll();
}
All works good, but when I click on the reset button, I can't drop on grid2 again!
You're calling the removeAll() method from the grid component here, not the store... which probably breaks the grid.
You should try with:
Ext.getCmp('grid2').getStore().removeAll();
Related
I am using DOJO datagrid version 1.10 What I want is on tab indexing the row in the grid should get highlighted so that user will be able to know on which row the focus is. But I am not getting the row focus.
You could listen on the dojox.grid.DataGrid::onCellFocus event. The event arguments are the focused cell-Object itself and the corresponding rowIndex.
function onCellFocus(cell, rowIndex) {
// first clear selection
grid.selection.clear();
// select the focused row
grid.selection.setSelected(rowIndex, true);
// invoke manually the render method
grid.render();
}
I've created a working fiddle for you, which can be found here.
I'm trying to create a set of buttons to replace the default L.Control.Draw buttons (only for a polyline, in my case). Using this answer
I have been able to replicate Draw, Edit, Delete and their associated 'Cancel' and 'Save' buttons. What I cannot figure out is how to replicate the 'Delete last point' function for the Draw button.
Call the deleteLastVertex method on your draw instance:
var drawPolyline = new L.Draw.Polyline(map, drawControl.options.polyline).enable();
drawPolyline.deleteLastVertex();
I made an application which performs drag and drop of different items: images and shapes. I limited the drop target to a specific layer: rightLayer in my case using a simple test with if ... else. Everything works great, except that I want to make an item revert back to its original position in the leftLayer when it doesn't attempt the borders of rightLayer (just like jquery, but in kineticJS). Or just disappear instantly.
Here's a JSFIDDLE . For a better understanding, try this use case:
drag the rectangle,
drop it right before the grid,
click on an item from the left layer.
You can self-destruct any clone dropped other than in the dropzone with a test in dragend.
A Demo: http://jsfiddle.net/m1erickson/2T68g/
clone1.on("dragend",function(){
// destroy this clone if dropped outside the dropzone
if(this.x()<dropzone.x()){
this.destroy();
layer.draw();
}
});
I want to add a special selection model to the celltable. Basically the function i want to have is to select a row on the table which is located on left side, a corresponding form will pop up on the right side.
I know so many people will use the singleSelectionModel with SelectionChangeHandler.
But there is problem with this method.
For example, if I select row 1 on the table. the form pop up. I close the form by clicking the close-button. Later then, I select the row 1 again, the event is not fired, because it is SelectionChangeHandler. I have to select other row before doing this. This is no good.
So I think there are a few ways to do this:
Make the row deselected right after I select the row.
Use click handler to fire the event ( to pop up the form)
Use other selection model with other selection handler to do this. (I have no ideas about this though)
So my questions are,
Does anyone know what kind of other selection handler I can use for this.
If I use the click handler on celltable, will there be any problem?
I just want to learn more about this. So any ideas will be welcome.
Thanks a lot.
Best Regards.
Use NoSelectionModel. It won't update the table view after the row is selected. That is, even if the same row is selected, the change event is fired.
//Here 'Contact' is the datatype of the record
final NoSelectionModel<Contact> selModel = new NoSelectionModel<Contact>();
selModel.addSelectionChangeHandler(new Handler() {
#Override
public void onSelectionChange(SelectionChangeEvent event) {
Contact clickedObject = selModel.getLastSelectedObject();
GWT.log("Selected " + clickedObject.name);
}
});
table.setSelectionModel(selModel);
I have using cell table in my each project. The better way to just deselect row manually as u mention. and make change css such as selected cell table's row look not changed after selection.
I need a listgrid with +/- button so that I can use these buttons for adding or deleting list grid.
ListGrid listGrid = new ListGrid();
listGrid.setWidth(230);
listGrid.setHeight(224);
listGrid.setDataSource(coursesDS);
listGrid.setCanDragRecordsOut(true);
listGrid.setDragDataAction(DragDataAction.COPY);
In this way only listgrid will be created, but is there any implicity functionality for increment listgrid by providing button specific to listgrid?
Or I need to create explicitly image button and have to write code so that I can add number of listgrids when click on image(add) button?
Please help. Thanks.
Regarding the "-" icon:
listGrid.setCanRemoveRecords(true);
Creates an additional rightmost column with "-" icon to remove the current row of the listGrid.
The closest I could find to "+" is in this example:
http://www.smartclient.com/smartgwt/showcase/#grid_editing_new_row
listGrid.startEditingNew();
in the example the line is executed from onClick function inside ClickHandler for additional button.