PDA

View Full Version : [OPEN] [#178] GridDragDrop Issues



bayoglu
Mar 17, 2013, 11:42 PM
Hello!,

I experience below issues with the attached sample code. Can you advice on the problem?
1) After changing the scroll level, selecting a row causes grid view to change. To test: After page load, move scroll bar to end and select a row. Grid view will change to show selected row at top or bottom. There is no problem when selecting in the current scroll position.
2) Clicking a column for sorting causes the column to be automatically dragged. (No problem with Chrome, I face it with Internet Explorer 9.)

Note: Problem #1 goes away if "<ext:GridDragDrop runat="server"></ext:GridDragDrop>" is removed.



<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
List<object> MyList = new List<object>();
for (short i = 0; i < 50; i++)
{
MyList.Add(new
{
ID = i,
Name = "Item " + i
});
}
this.MyStore.DataSource = MyList;
this.MyStore.DataBind();
}
}
</script>
<script type="text/javascript">
var getDragDropText = function () {
var buf = [];
buf.push("<ul>");
Ext.each(this.view.panel.getSelectionModel().getSe lection(), function (record) {
buf.push("<li>ID:&nbsp" + record.data.ID + "</li>");
buf.push("<li>Name:&nbsp" + record.data.Name + "</li>");
});
buf.push("</ul>");
return buf.join("");
};
</script>

<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Ext.NET Examples</title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" SourceFormatting="True" />
<ext:Store ID="MyStore" runat="server">
<Model>
<ext:Model ID="MyStoreModel" runat="server" IDProperty="ID">
<Fields>
<ext:ModelField Name="ID" Type="Int"></ext:ModelField>
<ext:ModelField Name="Name" Type="String"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
<ext:GridPanel ID="MyGrid" runat="server" StoreID="MyStore" MaxHeight="300" Collapsible="false" Flex="1" Title="My Form" SelectionMemory="false">
<ColumnModel runat="server" ID="MyColumnModel">
<Columns>
<ext:Column ID="ID" runat="server" Text="ID" DataIndex="ID" Align="Left" Flex="1">
</ext:Column>
<ext:Column ID="Name" runat="server" Text="Name" DataIndex="Name" Align="Left" Flex="1">
</ext:Column>
</Columns>
</ColumnModel>
<View>
<ext:GridView runat="server">
<Plugins>
<ext:GridDragDrop runat="server"></ext:GridDragDrop>
</Plugins>
<Listeners>
<AfterRender Handler="this.plugins[0].dragZone.getDragText = getDragDropText;" />
</Listeners>
</ext:GridView>
</View>
</ext:GridPanel>
</form>
</body>
</html>


Thanks.

Daniil
Mar 18, 2013, 8:14 AM
Hi @bayoglu,



2) Clicking a column for sorting causes the column to be automatically dragged. (No problem with Chrome, I face it with Internet Explorer 9.)


I am not exactly sure what you mean under "automatically dragged", but, maybe, you need to update from SVN. At least, I see the same behavior in IE9, FireFox and Chrome with and without a drag&drop plugin.

So, could you update and retest?

bayoglu
Mar 18, 2013, 5:57 PM
Hi @bayoglu,



I am not exactly sure what you mean under "automatically dragged", but, maybe, you need to update from SVN. At least, I see the same behavior in IE9, FireFox and Chrome with and without a drag&drop plugin.

So, could you update and retest?

Hello @Daniil,

Updating from trunk eliminated Problem #2. Problem #1 still continues. When I change the scroll level and select a row, grid view changes to show the selected row at top or bottom of the grid panel (where ever it is close).

Please see the video capture below.


http://www.youtube.com/watch?v=BgiBdRE8VKk

Thanks.

Daniil
Mar 19, 2013, 6:38 AM
Thank you for the details and video!

I reported a bug to Sencha.
http://www.sencha.com/forum/showthread.php?259118

bayoglu
Mar 19, 2013, 12:20 PM
Thank you for the details and video!

I reported a bug to Sencha.
http://www.sencha.com/forum/showthread.php?259118

Hello Daniil. Thanks, I will monitor the thread for the scrolling issue.

I opened a new but related thread here (http://forums.ext.net/showthread.php?23994-Grid-row-startDrag-on-time-consuming-select-handler&p=105047#post105047) for the "auto startDrag on select" issue (Problem #2). It happens for rows now (and in certain circumstances probably for columns also).

Daniil
Mar 19, 2013, 3:45 PM
Sencha opened a bug.

We created an Issue to monitor.
https://github.com/extnet/Ext.NET/issues/178

Daniil
Apr 03, 2013, 7:00 AM
Here is a related thread.
http://forums.ext.net/showthread.php?24185

There is the same problem with the TreeViewDragDrop plugin.

jchau
Apr 05, 2013, 5:35 PM
This is pretty much a deal breaker for us right now. Our users are screaming at us because it is causing them to perform the wrong actions when they double click on a treenode. What's the status of this from Sencha side?

Daniil
Apr 08, 2013, 12:24 PM
Agree this is a big problem.

Working on a workaround/fix for this issue I discovered that initializing drag&drop a bit later than on the "render" event, i.e. on the "afterrender" one, helps remedy the problem. At least, for a grid.


Ext.grid.plugin.DragDrop.override({
init : function(view) {
view.on('afterrender', this.onViewRender, this, {single: true}); // "afterrender" instead "render"
}
});

I didn't test with a tree, but I believe the following should also work.

Ext.tree.plugin.TreeViewDragDrop.override({
init : function(view) {
view.on('afterrender', this.onViewRender, this, {single: true}); // "afterrender" instead "render"
}
});

Well, I think it might be required to investigate the root of the problem, but, at least, it should not break anything and looks an absolutely appropriate workaround without having any backside effects.

Could someone test and confirm? We could commit the fix to SVN after confirmation.

jchau
Apr 08, 2013, 2:23 PM
Daniil, you are awesome! This fixed my issue with treepanel! Thank you soooooooo much. You guys provide 100x better support than ExtJS.

Daniil
Apr 08, 2013, 2:57 PM
Thank you for the kind words and confirmation. I committed the fix to SVN.