PDA

View Full Version : [OPEN] [#1195] PagingToolbar's input item has a clear trigger



RaphaelSaldanha
Dec 18, 2015, 6:09 PM
In the following example, PagingToolbar's input item has a clear trigger, what in my opinion it shouldn't have.

Thanks in advance.
24366


<!DOCTYPE html>
<html>
<head runat="server">
</head>
<body>
<ext:ResourceManager Theme="Crisp" ScriptMode="Debug" runat="server" />
<ext:GridPanel Title="Ext.NET" Border="true" Width="400" Height="280" runat="server">
<BottomBar>
<ext:PagingToolbar InputItemWidth="100" runat="server" />
</BottomBar>
<Store>
<ext:Store AutoLoad="true" runat="server">
<Proxy>
<ext:AjaxProxy Url="~/Example/LoadFakeRecords/">
<Reader>
<ext:JsonReader RootProperty="data" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model IDProperty="ID" runat="server">
<Fields>
<ext:ModelField Name="ID" Type="String" />
<ext:ModelField Name="Name" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column Text="ID" DataIndex="ID" runat="server" />
<ext:Column Text="Name" Flex="1" DataIndex="Name" runat="server" />
</Columns>
</ColumnModel>
</ext:GridPanel>
</body>
</html>




namespace SandBox.Controllers
{
public class ExampleController : System.Web.Mvc.Controller
{
public ActionResult Index() => View();

public StoreResult LoadFakeRecords()
{
List<Entity> lst = new List<Entity>();

for (int index = 0; index < 5; index++)
{
lst.Add(new Entity
{
ID = index,
Name = $"Name - {index}",
});
}
return new StoreResult(lst, lst.Count());
}
}

public class Entity
{
public int ID { get; set; }

public string Name { get; set; }
}
}

RaphaelSaldanha
Dec 18, 2015, 6:11 PM
It's possible to overcome the issue presented above by overriding Ext.toolbar.Paging.getPagingItems, as shown below.

Daniil, what is your opinion about that?



<!DOCTYPE html>
<html>
<head runat="server">
<script type="text/javascript">
Ext.toolbar.Paging.override({
getPagingItems: function () {
debugger;
var items = this.callParent(arguments);

for (var index = 0; index < items.length; index++) {
var item = items[index];
if (item.itemId == 'inputItem') {
item.removeClearTrigger = true;
break;
}
}
return items;
}
});
</script>
</head>
<body>
<ext:ResourceManager Theme="Crisp" ScriptMode="Debug" runat="server" />
<ext:GridPanel Title="Ext.NET" Border="true" Width="400" Height="280" runat="server">
<BottomBar>
<ext:PagingToolbar InputItemWidth="100" runat="server" />
</BottomBar>
<Store>
<ext:Store AutoLoad="true" runat="server">
<Proxy>
<ext:AjaxProxy Url="~/Example/LoadFakeRecords/">
<Reader>
<ext:JsonReader RootProperty="data" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model IDProperty="ID" runat="server">
<Fields>
<ext:ModelField Name="ID" Type="String" />
<ext:ModelField Name="Name" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column Text="ID" DataIndex="ID" runat="server" />
<ext:Column Text="Name" Flex="1" DataIndex="Name" runat="server" />
</Columns>
</ColumnModel>
</ext:GridPanel>
</body>
</html>

Daniil
Dec 19, 2015, 11:53 AM
Hi Raphael,

Well, it is IE's UI approach. I don't have a solid opinion how it should be. Probably, IE users expect to see this clear trigger for any field. From other side, it should probably look the same in all the browsers. Though, an IE user might ask like "Hey, there is my clear trigger?".

So, at some point we provided the RemoveClearTrigger and RemoveShowPasswordTrigger options on a TextField.

I think it would be good to have global RemoveClearTrigger and RemoveShowPasswordTrigger settings on a ResourceManager and they should be true by default. By the way, it is all related to IE only. So, maybe, RemoveIEClearTrigger and RemoveIEShowPasswordTrigger are better names.

Created a feature Issue:
https://github.com/extnet/Ext.NET/issues/1195

For now please use this CSS to turn those triggers off:

input::-ms-clear
{
display: none;
width : 0;
height: 0;
}

input::-ms-reveal {
display: none;
width : 0;
height: 0;
}

RaphaelSaldanha
Dec 21, 2015, 11:40 AM
I think it would be good to have global RemoveClearTrigger and RemoveShowPasswordTrigger settings on a ResourceManager and they should be true by default.

it would be nice if we could set that config up on Web.config <extnet> Global Configuration Properties.



By the way, it is all related to IE only. So, maybe, RemoveIEClearTrigger and RemoveIEShowPasswordTrigger are better names.

I agree.

Daniil
Dec 21, 2015, 11:46 AM
Yes, usually a ResourceManager's options reflect to Web.config.