PDA

View Full Version : [CLOSED] number fields in grid/columns



marco.morreale
May 18, 2012, 8:33 AM
Hi,
can you show me the best way to get a grid of number fileds in wich tu put quantity values?
Please look at the picture to see what I mean.
4257

Thanks in advance
Marco

marco.morreale
May 18, 2012, 8:39 AM
Please, note that controls should be rendered per column.
4258
M

Daniil
May 18, 2012, 10:51 AM
Hi,

I can suggest the following solution.

Example

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

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Container
runat="server"
Height="75"
Width="250"
Layout="HBoxLayout">
<Items>
<ext:Container runat="server" Flex="1">
<Defaults>
<ext:Parameter Name="labelWidth" Value="30" Mode="Raw" />
<ext:Parameter Name="width" Value="70" Mode="Raw" />
</Defaults>
<Items>
<ext:NumberField runat="server" FieldLabel="label" />
<ext:NumberField runat="server" FieldLabel="label" />
<ext:NumberField runat="server" FieldLabel="label" />
</Items>
</ext:Container>
<ext:Container runat="server" Flex="1">
<Defaults>
<ext:Parameter Name="labelWidth" Value="30" Mode="Raw" />
<ext:Parameter Name="width" Value="70" Mode="Raw" />
</Defaults>
<Items>
<ext:NumberField runat="server" FieldLabel="label" />
<ext:NumberField runat="server" FieldLabel="label" />
<ext:NumberField runat="server" FieldLabel="label" />
</Items>
</ext:Container>
<ext:Container runat="server" Flex="1">
<Defaults>
<ext:Parameter Name="labelWidth" Value="30" Mode="Raw" />
<ext:Parameter Name="width" Value="70" Mode="Raw" />
</Defaults>
<Items>
<ext:NumberField runat="server" FieldLabel="label" />
<ext:NumberField runat="server" FieldLabel="label" />
</Items>
</ext:Container>
</Items>
</ext:Container>
</form>
</body>
</html>


You will have to manually put a NumberField into a respective column.

marco.morreale
May 18, 2012, 12:21 PM
I hoped for something more dynamic.

The number and labels of numberfields are the result of a query.

Is there a way to bind the control to a store?

M

Daniil
May 18, 2012, 1:27 PM
Is there a way to bind the control to a store?

Generally, no. You could only load a Store record data into FormPanel fields values.



I hoped for something more dynamic.

The number and labels of numberfields are the result of a query.

You can render these fields dynamically either on server or client sides. I've just demonstrated a layout you could use.

marco.morreale
May 18, 2012, 2:11 PM
Do you mean that I should dynamically create the numberFields and calculate for each one wich container to put them in?

If so, maybe aspnet Datalist is a easier way.

M

Daniil
May 18, 2012, 5:22 PM
Do you mean that I should dynamically create the numberFields and calculate for each one wich container to put them in?

Well, I don't think it would be difficult. You just should know Height of the main container (with HBoxLayout) and Height of a single NumberField.



If so, maybe aspnet Datalist is a easier way.

At the first glance, we think it won't be easier with DataList. Though we are not sure. If you would demonstrate how it can be achieved using DataList, we will try to get the same in Ext.NET (if it will be possible).