Sep 16, 2015, 2:42 PM
[CLOSED] negative Ids in table are considered CREATE not UPDATE
v3.2.1
I load a grid and mark the IDProperty properly in the model. Then when i load the grid with data.... i use a negative value for the IDProperty field. When i submit the grid as a batch submit, it assumes negative values are CREATED (instead of UPDATED). in v1,7, only values==0 are CREATED and negative values are UPDATED.
price is editable
This is a serious issue and should be reverted!
also, it converts all negative values to zero.
Thanks,
/Z
markup
I load a grid and mark the IDProperty properly in the model. Then when i load the grid with data.... i use a negative value for the IDProperty field. When i submit the grid as a batch submit, it assumes negative values are CREATED (instead of UPDATED). in v1,7, only values==0 are CREATED and negative values are UPDATED.
price is editable
This is a serious issue and should be reverted!
also, it converts all negative values to zero.
Thanks,
/Z
markup
<%@ Page Language="C#" %>
<script runat="server">
private object[] TestData
{
get
{
DateTime now = DateTime.Now;
return new object[]
{
new object[] {-1, "3m Co", "1/1 12:00am", "Up", 71.72, 0.02, 0.03, now },
new object[] {-2, "Alcoa Inc", "1/1 12:00am", "Up", 29.01, 0.42, 1.47, now },
new object[] {-3, "Altria Group Inc", "1/1 12:00am", "Up", 83.81, 0.28, 0.34, now }
};
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.Store1.DataSource = this.TestData;
}
}
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Cell to Cell Drag and Drop - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<h1>Drag and Drop from Cell to Cell within the same GridView</h1>
<p>This illustrates how a custom plugin can enable a cell to cell drag and drop operation within the same GridView.</p>
<p>This example only allows a drag and drop operation for cells with the same data type, although that is configurable. The custom plugin allows for other configs, please see the comments in the source.</p>
<ext:GridPanel ID="GridPanel1"
runat="server"
Width="800"
Height="400">
<Store>
<ext:Store
ID="Store1"
runat="server">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="id">
<Fields>
<ext:ModelField Name="id" Type="Int" />
<ext:ModelField Name="company" Type="String" />
<ext:ModelField Name="firstChange" Type="Date" DateFormat="M/d hh:mmtt" />
<ext:ModelField Name="stock" />
<ext:ModelField Name="price" Type="Float" />
<ext:ModelField Name="change" Type="Float" />
<ext:ModelField Name="pctChange" Type="Float" />
<ext:ModelField Name="lastChange" Type="Date" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ID="Column1" runat="server" Text="Company" DataIndex="company" Width="160" />
<ext:DateColumn ID="DateColumn1" runat="server" Text="First Updated" DataIndex="firstChange" Width="235" />
<ext:Column ID="Column2" runat="server" Text="Price" DataIndex="price" Width="75" >
<Editor>
<ext:TextField ID="TextField2" runat="server" />
</Editor>
</ext:Column>
<ext:Column ID="Column4" runat="server" Text="Change" DataIndex="change" Width="75" />
<ext:Column ID="Column5" runat="server" Text="% Change" DataIndex="pctChange" Width="75" />
<ext:DateColumn ID="DateColumn2" runat="server" Text="Last Updated" DataIndex="lastChange" Width="235" />
</Columns>
</ColumnModel>
<Plugins>
<ext:CellEditing ID="CellEditing1" ClicksToEdit="1" runat="server" />
</Plugins>
<BottomBar>
<ext:Toolbar ID="ToolbarTimecardButtons" runat="server">
<Items>
<ext:Button runat="server" Text="Save" Icon="Disk">
<DirectEvents>
<Click
Url="/test"
Timeout="60000"
CleanRequest="true"
Method="POST">
<EventMask MinDelay="250" />
<ExtraParams>
<ext:Parameter Name="data" Value="#{Store1}.getChangedData()" Mode="Raw" Encode="true" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
</Items>
</ext:Toolbar>
</BottomBar>
</ext:GridPanel>
</form>
</body>
</html>
controller public DirectResult test(FormCollection values)
{
StoreDataHandler dataHandler = new StoreDataHandler(values["data"]);
ChangeRecords<object> data = dataHandler.BatchObjectData<object>();
//data.Update is 0
//data.Create is >0
}
Last edited by Daniil; Sep 17, 2015 at 3:39 PM.
Reason: [CLOSED]