﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Coolite Forums / Coolite Toolkit / *Premium Help*  / Added Records don't show up as modified / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>Coolite Forums</description><link>http://www.coolite.com/forums/</link><webMaster>do-not-reply@coolite.com</webMaster><lastBuildDate>Sat, 13 Mar 2010 05:07:51 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Added Records don't show up as modified</title><link>http://www.coolite.com/forums/Topic1338-16-1.aspx</link><description>Hi Rod,&lt;br&gt;&lt;br&gt;you can look into the insertRecord of GridPanel. In this function you can see how to add row which will be marked as dirty&lt;br&gt;&lt;br&gt;[code]&lt;br&gt;insertRecord: function(rowIndex, values) {&lt;br&gt;        var f = this.record.prototype.fields, dv = [];&lt;br&gt;        for (var i = 0; i &amp;lt; f.length; i++) {&lt;br&gt;            dv[f.items[i].name] = f.items[i].defaultValue;&lt;br&gt;        }&lt;br&gt;        var record = new this.record(dv);&lt;br&gt;        record.firstEdit = true;&lt;br&gt;        record.newRecord = true;&lt;br&gt;        this.stopEditing();&lt;br&gt;        this.store.insert(rowIndex, record);&lt;br&gt;        values = values || {};&lt;br&gt;        for (var v in values) {&lt;br&gt;            record.set(v, values[v]);&lt;br&gt;        }&lt;br&gt;}&lt;br&gt;[/code]&lt;br&gt;&lt;br&gt;Hope this help&lt;br&gt;</description><pubDate>Fri, 21 Nov 2008 02:54:34 GMT</pubDate><dc:creator>vladsch</dc:creator></item><item><title>RE: Added Records don't show up as modified</title><link>http://www.coolite.com/forums/Topic1338-16-1.aspx</link><description>&lt;P&gt; Hello.&lt;BR&gt;I also got this problem, and can't get it to work even with tour workaround, and I'm getting stuck with it :/&lt;BR&gt;&lt;BR&gt;I'm adding some pics by drag/drop to a dataview, and handling the drop in order to add them to a store :&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;Original version : working fine, except that records are not set modified/dirty.&lt;BR&gt;[code]&lt;BR&gt;onNodeDrop: function(target, dd, e, data) {&lt;BR&gt; if (g.store.find('id', data.pictureData.id) != -1)&lt;BR&gt;  return false;&lt;BR&gt; var store = g.store;&lt;BR&gt; var record = Ext.data.Record.create([&lt;BR&gt;       { name: 'id' },&lt;BR&gt;       { name: 'name' },&lt;BR&gt;       { name: 'urlMini' }&lt;BR&gt;        ]);&lt;BR&gt; var ajoutPicture = new record({&lt;BR&gt;  id: data.pictureData.id,&lt;BR&gt;  name: data.pictureData.miniName,&lt;BR&gt;  urlMini: data.pictureData.urlMini&lt;BR&gt; });&lt;BR&gt; &lt;BR&gt; store.insert(0, ajoutPicture);&lt;BR&gt;  &lt;BR&gt; g.setTemplate(tplSelection);&lt;BR&gt; g.refresh();&lt;BR&gt; nbElement = store.data.length;&lt;BR&gt; scrollToEnd(refresh_arrows());&lt;BR&gt; &amp;#100;ocument.getElementById('nbImages').innerText = '(' + nbElement + ')';&lt;BR&gt; &amp;#100;ocument.getElementById('viderSelectionDiv').style.visibility = 'visible';&lt;/P&gt;&lt;P&gt; return true;&lt;BR&gt;}&lt;BR&gt;[/code]&lt;BR&gt;&lt;BR&gt;Workaround : fails with "'parentNode is Null or not an object", and no modified record either.&lt;BR&gt;[code]&lt;BR&gt;onNodeDrop: function(target, dd, e, data) {&lt;BR&gt; if (g.store.find('id', data.pictureData.id) != -1)&lt;BR&gt;  return false;&lt;BR&gt; var store = g.store;&lt;BR&gt; var record = Ext.data.Record.create([&lt;BR&gt;       { name: 'id' },&lt;BR&gt;       { name: 'name' },&lt;BR&gt;       { name: 'urlMini' }&lt;BR&gt;        ]);&lt;BR&gt; var ajoutPicture = new record({&lt;BR&gt;  id: '',&lt;BR&gt;  name: '',&lt;BR&gt;  urlMini: ''&lt;BR&gt; });&lt;BR&gt; &lt;BR&gt; ajoutPicture.newRecord = true;&lt;BR&gt; store.add(ajoutPicture);&lt;BR&gt; &lt;BR&gt; ajoutPicture.set('id', data.pictureData.id);&lt;BR&gt; ajoutPicture.set('name', data.pictureData.miniName);&lt;BR&gt; ajoutPicture.set('urlMini', data.pictureData.urlMini);&lt;BR&gt; &lt;BR&gt; g.setTemplate(tplSelection);&lt;BR&gt; g.refresh();&lt;BR&gt; nbElement = store.data.length;&lt;BR&gt; scrollToEnd(refresh_arrows());&lt;BR&gt; &amp;#100;ocument.getElementById('nbImages').innerText = '(' + nbElement + ')';&lt;BR&gt; &amp;#100;ocument.getElementById('viderSelectionDiv').style.visibility = 'visible';&lt;/P&gt;&lt;P&gt; return true;&lt;BR&gt;}&lt;BR&gt;[/code]&lt;BR&gt;&lt;BR&gt;I was able to set a record dirty by simply adding &lt;BR&gt;[code]&lt;BR&gt;    pictureData.set('foo', 'bar');&lt;BR&gt;[/code]&lt;BR&gt;after Insert, but I got the same javascript error.&lt;BR&gt;&lt;BR&gt;Any idea how I could fix that? I would like it to work with v0.6 in order to avoid any breaking changes :(&lt;BR&gt;&lt;BR&gt;Thx :)&lt;/P&gt;</description><pubDate>Wed, 19 Nov 2008 09:22:31 GMT</pubDate><dc:creator>Rod</dc:creator></item><item><title>RE: Added Records don't show up as modified</title><link>http://www.coolite.com/forums/Topic1338-16-1.aspx</link><description>Hi Dave,&lt;br&gt;&lt;br&gt;I reproduced your problem. The fix will be ready soon. For now you can use next workaround:&lt;br&gt;&lt;br&gt;[code]&lt;br&gt;&lt;span&gt;&lt;span&gt;&lt;span id="ctl10_ctlTopic"&gt;&lt;span id="ctl10_ctlTopic_ctlPanelBar_ctlTopicsRepeater_ctl06_lblFullMessage"&gt;&lt;pre&gt;    recDef = Ext.data.Record.create(['NoteId', 'Username', 'ShowOnTrackingSheet', 'Updated', 'ShortText', 'FullNote']);    &lt;br&gt;   &lt;span&gt;&lt;span&gt;&lt;span id="ctl10_ctlTopic"&gt;&lt;span id="ctl10_ctlTopic_ctlPanelBar_ctlTopicsRepeater_ctl06_lblFullMessage"&gt;&lt;pre&gt;    // need to use default values, in other case the cells in grid will be don't marked&lt;br&gt;    // as modified (but the saving will be perform in any case). &lt;br&gt;    //If no need cell marking then just use a empty object {}&lt;br&gt;&lt;br&gt;    newrec = new recDef({ShowOnTrackingSheet:'', FullNote:''});&lt;br&gt;    newrec.newRecord = true;&lt;br&gt;    this.add(newrec);&lt;br&gt;    newrec.set('ShowOnTrackingSheet&lt;span&gt;&lt;span&gt;&lt;span id="ctl10_ctlTopic"&gt;&lt;span id="ctl10_ctlTopic_ctlPanelBar_ctlTopicsRepeater_ctl06_lblFullMessage"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;', show);&lt;br&gt;    newrec.set('FullNote', fullnote);   &lt;br&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;[/code]&lt;br&gt;&lt;br&gt;&lt;br&gt;</description><pubDate>Mon, 01 Sep 2008 06:37:40 GMT</pubDate><dc:creator>vladsch</dc:creator></item><item><title>RE: Added Records don't show up as modified</title><link>http://www.coolite.com/forums/Topic1338-16-1.aspx</link><description> Here's some sample code for when I'm adding a record - newRecord doesn't make any difference&lt;br&gt;&lt;br&gt;[code]&lt;br&gt;    recDef = Ext.data.Record.create(['NoteId', 'Username', 'ShowOnTrackingSheet', 'Updated', 'ShortText', 'FullNote']);    &lt;br&gt;    newrec = new recDef({ShowOnTrackingSheet:show, FullNote:fullnote});&lt;br&gt;    newrec.newRecord = true;&lt;br&gt;    this.add(newrec);&lt;br&gt;[/code]&lt;br&gt;&lt;br&gt;I'm not adding to the grid - I'm adding directly to a store.  I'm going to change this now - I was using two stores, but I think only one store is really needed.  &lt;br&gt;&lt;br&gt;But, the point still stands: if you add a record via this code, the record you've added doesn't show up as a modified record.  the save() function on the coolite store runs "json.getChangedData" to see if anything had changed.  This looks only at deleted and modified records, and the store doesn't show added records as either of these.  (which I don't really understand...)&lt;br&gt;&lt;br&gt;Anyway, a new record isn't added to the modified, so it doesn't get picked up and the save proxy isn't called.&lt;br&gt;&lt;br&gt;My suggestion would be to override the add method on Store, add the records that have been added to the modified collection, and then call the normal add method.  Or - do it on the save, based on the newRecord flag.&lt;br&gt;</description><pubDate>Mon, 01 Sep 2008 05:55:56 GMT</pubDate><dc:creator>Dave.Sanders</dc:creator></item><item><title>RE: Added Records don't show up as modified</title><link>http://www.coolite.com/forums/Topic1338-16-1.aspx</link><description>Hi Dave,&lt;br&gt;&lt;br&gt;How are you added records? Can you post your code? The GridPanel (Coolite version) has addRecord and insertRecord functions. If you use own code for insert a new record to the store then please ensure that record has newRecord = true field&lt;br&gt;&lt;br&gt;Please let me know if addRecord or insertRecord functions don't work for you&lt;br&gt;&lt;br&gt;&lt;br&gt;</description><pubDate>Sun, 31 Aug 2008 23:12:41 GMT</pubDate><dc:creator>vladsch</dc:creator></item><item><title>Added Records don't show up as modified</title><link>http://www.coolite.com/forums/Topic1338-16-1.aspx</link><description>Hey Geoff,&lt;br&gt;&lt;br&gt;I'm not sure if you've addressed this or not, but I found out tonight that added records to the store don't show up as "modified" so they aren't picked up on the save from the new grid.&lt;br&gt;&lt;br&gt;I found a post about it here on the ext forums: http://extjs.com/forum/showthread.php?t=41651  We might consider adding something similar.&lt;br&gt;&lt;br&gt;I'm adding a new record by creating the record and then just doing a store.add on it.&lt;br&gt;</description><pubDate>Sun, 31 Aug 2008 18:05:39 GMT</pubDate><dc:creator>Dave.Sanders</dc:creator></item></channel></rss>