Nov 09, 2015, 2:50 AM
[CLOSED] set dirty flag
This is a semi-follow up to a previous post last week. In this example, i have two icons, the penguin and the door.
Basically, click the penguin and see the dirty flag.
now reload
Now click the door icon. you can see the change BUT there is no dirty flag. THe reason is that the change is on a child sub object. And as a result, there is no dirty flag. I then use an updated variable in the model to flag the record as dirty.
However, i am missing a the vital dirty flag (on the template column) to show the user the record is dirty. How can i set this on the specific cell?
Thanks,
/Z
Basically, click the penguin and see the dirty flag.
now reload
Now click the door icon. you can see the change BUT there is no dirty flag. THe reason is that the change is on a child sub object. And as a result, there is no dirty flag. I then use an updated variable in the model to flag the record as dirty.
However, i am missing a the vital dirty flag (on the template column) to show the user the record is dirty. How can i set this on the specific cell?
Thanks,
/Z
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Collections.Generic" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
this.Store1.DataSource = new List<Project>
{
new Project(100, "Ext Forms: Field Anchoring", 1, "Integrate 2.0 Forms with 2.0 Layouts", 6, 150, 0, new DateTime(2007, 06, 24)),
new Project(100, "Ext Forms: Field Anchoring", 2, "Implement AnchorLayout", 4, 150, 0, new DateTime(2007, 06, 25)),
new Project(100, "Ext Forms: Field Anchoring", 3, "Add support for multiple types of anchors", 4, 150, 0, new DateTime(2007, 06, 27)),
new Project(100, "Ext Forms: Field Anchoring", 4, "Testing and debugging", 8, 0, 0, new DateTime(2007, 06, 29)),
new Project(100, "Ext Forms: Field Anchoring", 5, "Integrate 2.0 Forms with 2.0 Layouts", 6, 150, 0, new DateTime(2007, 06, 24)),
new Project(100, "Ext Forms: Field Anchoring", 6, "Implement AnchorLayout", 4, 150, 0, new DateTime(2007, 06, 25)),
new Project(100, "Ext Forms: Field Anchoring", 7, "Add support for multiple types of anchors", 4, 150, 0, new DateTime(2007, 06, 27)),
};
this.Store1.DataBind();
}
public class Project
{
public Project(int projectId, string name, int taskId, string description, int estimate, double rate, double cost, DateTime due)
{
this.ProjectID = projectId;
this.Name = name;
this.TaskID = taskId;
this.Description = description;
this.Estimate = estimate;
this.Rate = rate;
this.Due = due;
this.tasks = new List<Task>();
this.tasks.Add(new Task("111"));
this.tasks.Add(new Task("222"));
this.tasks.Add(new Task("333"));
}
public int ProjectID { get; set; }
public string Name { get;set; }
public int TaskID { get; set; }
public string Description { get;set; }
public int Estimate { get;set; }
public double Rate { get; set; }
public double Cost { get; set; }
public DateTime Due { get; set; }
public List<Task> tasks { get; set; }
public Task t1 { get; set; }
}
public class Task
{
public Task(string test)
{
this.strTest.Add(test);
}
public List<string> strTest = new List<string>();
}
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Menu bug</title>
<script>
var loadCombo = function () {
var ctl = App.testssdsdf;
var data = [];
data.push({ id: 1, dates: "Some Data 1" });
data.push({ id: 2, dates: "Start Data 2" });
data.push({ id: 3, dates: "End Data 3" });
data.push({ id: 4, dates: "Star Data 4" });
data.push({ id: 5, dates: "Sta Data 5" });
ctl.getStore().loadData(data);
}
var saveMouseDown = function (grid, record, item, index, e, eOpts) {
if (e.button == 0) { //left button
console.log( e.position.column==null);
}
};
var testNormal = function () {
App.GridPanel1.getStore().getAt(0).set('Name', 'test');
}
var testAbnormal = function () {
var record = App.GridPanel1.getStore().getAt(0);
var tasks = record.data.tasks;
tasks[2].strTest[0] = 'aaaa';
record.set('tasks', tasks);
record.set('updated', new Date().getTime());
}
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<h1>Menu overflow bug</h1>
<ext:Viewport runat="server" Layout="FitLayout">
<Items>
<ext:GridPanel
ID="GridPanel1"
runat="server"
Title="Test"
ColumnLines="true"
Layout="FitLayout">
<TopBar>
<ext:Toolbar ID="ToolbarTimecard" runat="server" EnableOverflow="true" >
<Items>
<ext:Button ID="ButtonPr" runat="server" Icon="Tux">
<Listeners>
<Click Handler="testNormal();" />
</Listeners>
</ext:Button>
<ext:Button ID="Button1" runat="server" Icon="Door">
<Listeners>
<Click Handler="testAbnormal();" />
</Listeners>
</ext:Button>
<ext:ComboBox ID="testssdsdf"
runat="server"
ForceSelection="true"
Hidden="true"
TriggerAction="All"
Width="170"
DisplayField="dates"
QueryMode="Local"
ValueField="id" >
<Store>
<ext:Store ID="Store2" runat="server">
<Model>
<ext:Model ID="Model2" IDProperty="id" runat="server">
<Fields>
<ext:ModelField Name="id" Type="Int" />
<ext:ModelField Name="dates" Type="String"/>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
</Items>
</ext:Toolbar>
</TopBar>
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="TaskID">
<Fields>
<ext:ModelField Name="ProjectID" Type="Int" />
<ext:ModelField Name="Name" />
<ext:ModelField Name="TaskID" Type="Int" />
<ext:ModelField Name="Description" />
<ext:ModelField Name="Estimate" Type="Int" />
<ext:ModelField Name="Rate" Type="Float" />
<ext:ModelField Name="Cost" Type="Float" />
<ext:ModelField Name="Due" Type="Date" />
<ext:ModelField Name="tasks" Mapping="tasks" IsComplex="true" Type="Auto" />
<ext:ModelField Name="updated" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ID="Column1"
runat="server"
TdCls="task"
Text="Task"
Sortable="true"
DataIndex="Description"
Hideable="false"
Width="300">
</ext:Column>
<ext:Column ID="Column2" runat="server" Text="Project" DataIndex="Name" Width="180" />
<ext:DateColumn ID="DateColumn1"
runat="server"
Width="130"
Text="Due Date"
Sortable="true"
DataIndex="Due"
Format="MM/dd/yyyy">
</ext:DateColumn>
<ext:Column ID="Column3"
runat="server"
Width="130"
Text="Estimate"
Sortable="true"
DataIndex="Estimate">
</ext:Column>
<ext:Column ID="Column4"
runat="server"
Width="130"
Text="Rate"
Sortable="true"
DataIndex="Rate">
</ext:Column>
<ext:Column
runat="server"
Width="130"
ID="Cost"
Text="Cost"
Sortable="false"
Groupable="false"
DataIndex="Cost">
</ext:Column>
<ext:TemplateColumn runat="server" ID="tasks" Text="test" DataIndex="tasks">
<Tpl runat="server">
<Html>
<tpl for=".">
<tpl for="tasks">
{strTest}<br />
</tpl>
</tpl>
</Html>
</Tpl>
</ext:TemplateColumn>
</Columns>
</ColumnModel>
<View>
<ext:GridView ID="GridView7" runat="server" StripeRows="true">
</ext:GridView>
</View>
<Listeners>
<ItemMouseDown Fn="saveMouseDown" />
</Listeners>
<SelectionModel>
<ext:RowSelectionModel runat="server" Mode="Single" />
</SelectionModel>
</ext:GridPanel>
</Items>
</ext:Viewport>
</form>
</body>
</html>
Last edited by Daniil; Nov 16, 2015 at 12:17 PM.
Reason: [CLOSED]