New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GridPanel's Ext.Net.GridView enableTextSelection setting does not work at all #1350

Closed
fabriciomurta opened this Issue Jun 25, 2016 · 2 comments

Comments

Projects
None yet
1 participant
@fabriciomurta
Contributor

fabriciomurta commented Jun 25, 2016

This was reported in this thread: GridView EnableTextSelection no works
Related ExtJS Issue: (classic) enableTextSelection not working in ExtJS 6.0.2 nightlies

The user didn't provide a test case, so here it is:

<%@ Page Language="C#" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!X.IsAjaxRequest)
        {
            this.Store1.DataSource = this.Data;
        }
    }

    private object[] Data
    {
        get
        {
            return new object[]
            {
                new object[] { "3m Co", 71.72, 0.02, 0.03, "9/1 12:00am" },
                new object[] { "Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am" },
                new object[] { "Altria Group Inc", 83.81, 0.28, 0.34, "9/1 12:00am" },
                new object[] { "American Express Company", 52.55, 0.01, 0.02, "9/1 12:00am" },
                new object[] { "American International Group, Inc.", 64.13, 0.31, 0.49, "9/1 12:00am" }
            };
        }
    }
</script>

<!DOCTYPE html>

<html>
<head runat="server">
    <title>Simple Array Grid - Ext.NET Examples</title>
    <link href="/resources/css/examples.css" rel="stylesheet" />

    <style>
        .x-grid-row-over .x-grid-cell-inner {
            font-weight : bold;
        }
    </style>

    <script>
        var template = '<span style="color:{0};">{1}</span>';

        var change = function (value) {
            return Ext.String.format(template, (value > 0) ? "green" : "red", value);
        };

        var pctChange = function (value) {
            return Ext.String.format(template, (value > 0) ? "green" : "red", value + "%");
        };
    </script>
</head>
<body>
    <ext:ResourceManager runat="server" />

    <h1>Simple Array Grid</h1>

    <ext:GridPanel
        ID="GridPanel1"
        runat="server"
        Title="Array Grid"
        Width="700"
        Height="350">
        <Store>
            <ext:Store ID="Store1" runat="server">
                <Model>
                    <ext:Model runat="server">
                        <Fields>
                            <ext:ModelField Name="company" />
                            <ext:ModelField Name="price" Type="Float" />
                            <ext:ModelField Name="change" Type="Float" />
                            <ext:ModelField Name="pctChange" Type="Float" />
                            <ext:ModelField Name="lastChange" Type="Date" DateFormat="M/d hh:mmtt" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
        </Store>
        <ColumnModel>
            <Columns>
                <ext:Column runat="server" Text="Company" DataIndex="company" Flex="1" />
                <ext:Column runat="server" Text="Price" DataIndex="price">
                    <Renderer Format="UsMoney" />
                </ext:Column>
                <ext:Column runat="server" Text="Change" DataIndex="change">
                    <Renderer Fn="change" />
                </ext:Column>
                <ext:Column runat="server" Text="Change" DataIndex="pctChange">
                    <Renderer Fn="pctChange" />
                </ext:Column>
                <ext:DateColumn runat="server" Text="Last Updated" DataIndex="lastChange" Width="120" />
            </Columns>
        </ColumnModel>
        <ViewConfig EnableTextSelection="true" />
        <BottomBar>
            <ext:Toolbar runat="server">
                <Items>
                    <ext:Button runat="server" Text="Print" Icon="Printer" Handler="this.up('grid').print();" />
                </Items>
            </ext:Toolbar>
        </BottomBar>
    </ext:GridPanel>
</body>
</html>

In current ExtJS release, the option does not enable mouse-drag-selecting text in grid panels when the view's option enableTextSelection is true.

And this override "works around" the problem (provided in Sencha thread's post #4):

Ext.define('ExtOverrides.grid.NavigationModel', {
   override: 'Ext.grid.NavigationModel',
   onCellMouseDown: function(view, cell, cellIndex, record, row, recordIndex, mousedownEvent) {
      var targetComponent = Ext.Component.fromElement(mousedownEvent.target, cell),
         ac;
      if (view.actionableMode && (mousedownEvent.getTarget(null, null, true).isTabbable() || ((ac = Ext.ComponentManager.getActiveComponent()) && ac.owns(mousedownEvent)))) {
         return;
      }
      if (mousedownEvent.pointerType !== 'touch') {
         // mousedownEvent.preventDefault(); // commented for text selection
         this.setPosition(mousedownEvent.position, null, mousedownEvent);
      }
      if (targetComponent && targetComponent.isFocusable && targetComponent.isFocusable()) {
         view.setActionableMode(true, mousedownEvent.position);
         targetComponent.focus();
      }
   }
});
@fabriciomurta

This comment has been minimized.

Show comment
Hide comment
@fabriciomurta

fabriciomurta Jan 6, 2017

Contributor

Update: Issue still open after ExtJS 6.2.1 release.

Contributor

fabriciomurta commented Jan 6, 2017

Update: Issue still open after ExtJS 6.2.1 release.

@fabriciomurta fabriciomurta added the 4.x label Jan 6, 2017

@fabriciomurta fabriciomurta removed this from the 4.2.0 milestone Jan 10, 2017

@fabriciomurta fabriciomurta added this to the 4.3.0 milestone Jul 21, 2017

@fabriciomurta fabriciomurta self-assigned this Jul 21, 2017

@fabriciomurta

This comment has been minimized.

Show comment
Hide comment
@fabriciomurta

fabriciomurta Jul 21, 2017

Contributor

The issue could not be reproduced in upcoming Ext.NET 4.3.0.

Contributor

fabriciomurta commented Jul 21, 2017

The issue could not be reproduced in upcoming Ext.NET 4.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment