<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Comment out console.log and see if that fixes your problem.
Please someone correct me if I’m wrong, but isn’t that firebug
only?<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> jagdish eashwar
[mailto:jagdish.eashwar@gmail.com] <br>
<b>Sent:</b> Friday, April 17, 2009 12:20 AM<br>
<b>To:</b> The elegant MVC web framework<br>
<b>Subject:</b> Re: [Catalyst] Jason Kohles' tutorial on ExtJs editable data
grids and Catalyst<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='margin-bottom:12.0pt'>Hi,<br>
No I don't get any javascript error in the error log when I hit 'save',
and it doesn't save the changes in the database either. Just nothing happens.<o:p></o:p></p>
<div>
<p class=MsoNormal>On Thu, Apr 16, 2009 at 9:34 PM, W. Tyler Gee <<a
href="mailto:geekout@gmail.com">geekout@gmail.com</a>> wrote:<o:p></o:p></p>
<p class=MsoNormal>Is there a javascript error when you hit save or is it
getting to the server? Where is your actual problem?<o:p></o:p></p>
<div>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p>
<div>
<p class=MsoNormal>On Thu, Apr 16, 2009 at 5:30 AM, jagdish eashwar <<a
href="mailto:jagdish.eashwar@gmail.com" target="_blank">jagdish.eashwar@gmail.com</a>>
wrote:<o:p></o:p></p>
<p class=MsoNormal>Hi Peter,<br>
Thanks for writing in. It is really not my code at all. I have taken it all
from the tutorial. I thought that people will get a better perspective if I
referred them to the tutorial. Nevertheless, I am pasting code from the
advent.js file below. ( I have made a few inconsequential changes though, like
the values in the drop down etc.)<br>
<br>
/*<br>
* advent.js<br>
*/<br>
<br>
Ext.onReady(function() {<br>
<br>
var col_model = new Ext.grid.ColumnModel([<br>
{<br>
id: 'id',<br>
header: 'ID',<br>
dataIndex: 'id',<br>
width: 40<br>
},<br>
{<br>
id: 'name',<br>
header: 'Name',<br>
dataIndex: 'name',<br>
editor: new
Ext.form.TextField({<br>
allowBlank: false,<br>
})<br>
},<br>
{<br>
id: 'occupation',<br>
header: 'Occupation',<br>
dataIndex: 'occupation',<br>
width: 70,<br>
editor: new Ext.form.ComboBox({<br>
typeAhead: true,<br>
triggerAction: 'all',<br>
transform: 'occpopup',<br>
lazyRender: true,<br>
listClass: 'x-combo-list-small'<br>
})<br>
}<br>
]); <br>
<br>
col_model.defaultSortable = true;<br>
<br>
<br>
var People = Ext.data.Record.create([<br>
{ name:
'id', type: 'int'},<br>
{ name: 'name',
type: 'string'},<br>
{ name: 'occupation',
type: 'string'}<br>
]);<br>
<br>
<br>
var store = new Ext.data.JsonStore({<br>
url: gridurl,<br>
root: 'people',<br>
fields: People<br>
});<br>
<br>
var grid = new Ext.grid.EditorGridPanel({<br>
store:
store,<br>
cm:
col_model,<br>
title:
'Edit Persons',<br>
width:
600,<br>
height:
300,<br>
frame:
true,<br>
autoExpandColumn:
'name',<br>
renderTo:
'datagrid',<br>
tbar:
[<br>
{
<br>
text: 'New Person',<br>
handler: function() {<br>
var p = new People({<br>
name: 'Unnamed New
Person',<br>
occupation: 'Unknown',<br>
}); <br>
grid.stopEditing();<br>
store.insert( 0, p );<br>
grid.startEditing( 0, 1 );<br>
},<br>
},<br>
{<br>
text: 'Save
Changes',<br>
handler: function() {<br>
grid.stopEditing();<br>
var changes = new Array();<br>
var dirty = store.getModifiedRecords();<br>
for ( var i = 0 ; i < dirty.length ; i++ ) {<br>
var id = dirty[i].get( 'id' );<br>
var fields = dirty[i].getChanges();<br>
<a href="http://fields.id" target="_blank">fields.id</a> = dirty[i].get( 'id'
);<br>
changes.push( fields );<br>
}<br>
console.log( changes );<br>
submitChanges( changes );<br>
store.commitChanges();<br>
},<br>
},<br>
{<br>
text: 'Discard Changes',<br>
handler: function() {<br>
grid.stopEditing();<br>
store.rejectChanges();<br>
},<br>
}<br>
]<br>
});<br>
<br>
<br>
store.load();<br>
<br>
function submitChanges( data ) {<br>
Ext.Ajax.request({<br>
url: posturl,<br>
success: function() { store.reload() },<br>
params: { changes: Ext.util.JSON.encode( data ) }<br>
});<br>
}<br>
});<br>
<br>
gridurl and posturl are defined in index.tt2 pasted below. It also contains a
link to advent.js.<br>
<br>
[% META title = 'Advent AJAX Grid' %]<br>
<script type = "text/javascript"><br>
var posturl = '[%
Catalyst.uri_for("/people_data_submit") %]';<br>
var gridurl = '[% Catalyst.uri_for("/people_data")
%]';<br>
</script><br>
[% js_link (src = '/static/advent.js') %]<br>
<div id = "datagrid"></div><br>
<select id="occpopup" style="display: none"><br>
<option value="SBI">SBI</option><br>
<option value="IBS">IBS</option><br>
<option value="ICICI">ICICI</option><br>
<option value="SELF">SELF</option><br>
</select><o:p></o:p></p>
<div>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><br>
<br>
<br>
<br>
<o:p></o:p></p>
<div>
<p class=MsoNormal>On Thu, Apr 16, 2009 at 7:41 PM, Peter Karman <<a
href="mailto:peter@peknet.com" target="_blank">peter@peknet.com</a>> wrote:<o:p></o:p></p>
<p class=MsoNormal>jagdish eashwar wrote on 04/16/2009 05:55 AM:<o:p></o:p></p>
<div>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'>> Hi,<br>
><br>
> I have been able to work through all of Jason Kohles' tutorial except the<br>
> part about saving changes back in the database. The 'New Person' and<br>
> 'Discard Changes' in the tool bar are working, but the 'Save Changes' is<br>
> not. I have checked several times for any typing mistakes that I might
have<br>
> committed, but that part of the code is not working for me. I wonder
if the<br>
> argument ('data') in the submitChanges function is to be substituted with<br>
> something more explicit by the reader. I will be glad to receive some help<br>
> and guidance.<br>
><br>
> I forgot to mention in my earlier post that the tutorial is available at<br>
> <a href="http://www.catalystframework.org/calendar/2007/9" target="_blank">http://www.catalystframework.org/calendar/2007/9</a>.<o:p></o:p></p>
</div>
</div>
<p class=MsoNormal>Tip: you won't get any useful help until you show us your
code.<br>
<br>
<br>
--<br>
Peter Karman . <a href="mailto:peter@peknet.com" target="_blank">peter@peknet.com</a>
. <a href="http://peknet.com/" target="_blank">http://peknet.com/</a><br>
<br>
<br>
_______________________________________________<br>
List: <a href="mailto:Catalyst@lists.scsys.co.uk" target="_blank">Catalyst@lists.scsys.co.uk</a><br>
Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"
target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
Searchable archive: <a
href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><o:p></o:p></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><br>
_______________________________________________<br>
List: <a href="mailto:Catalyst@lists.scsys.co.uk" target="_blank">Catalyst@lists.scsys.co.uk</a><br>
Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"
target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
Searchable archive: <a
href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><o:p></o:p></p>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p>
</div>
</div>
<blockquote style='margin-left:0in;margin-top:.25in;margin-right:0in;
margin-bottom:.25in'>
<p class=MsoNormal>~Tyler<o:p></o:p></p>
</blockquote>
<p class=MsoNormal style='margin-bottom:12.0pt'><br>
_______________________________________________<br>
List: <a href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a><br>
Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"
target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
Searchable archive: <a
href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
Dev site: <a href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><o:p></o:p></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</div>
</body>
</html>