<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: Re-Initialize Grid</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/re-initialize-grid</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/re-initialize-grid/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>KamelJabber on Re-Initialize Grid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/re-initialize-grid#p27980</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/re-initialize-grid#p27980</guid>
        	        	<description><![CDATA[<p>It was TOUGH but the answer was so simple!</p>
<p>After the unload I needed to reset my local variable:</p>
</p>
<pre>                    try {
                        $incidentGrid.jqGrid(&#39;GridUnload&#39;);
<strong>                        $incidentGrid = $(&#39;#tblJqGrid&#39;);</strong>
                    }
                    catch (e) {
                        alert(e.message);
                    }
</pre>
]]></description>
        	        	<pubDate>Fri, 04 Jan 2013 21:20:15 +0200</pubDate>
        </item>
        <item>
        	<title>KamelJabber on Re-Initialize Grid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/re-initialize-grid#p27979</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/re-initialize-grid#p27979</guid>
        	        	<description><![CDATA[<pre>I am trying to reuse the same grid on click of a menu.  So when the user clicks on the menu item I want to&#160;</pre>
<pre>reload the grid with a new set of parameters. Everything about the grid stays the same, just the parameters&#160;</pre>
<pre>have changed.  The parameters that are changing is in &#39;postData&#39;.  I tried so many variations of methods to&#160;</pre>
<pre>accomplish this but I just can&#39;t seem to get it to work.  I tried &#39;setGridParam&#39; then a .trigger(&#39;reloadGrid&#39;). &#160;</pre>
<pre>That didn&#39;t work.  The below &#39;GridUnload" raises an error the second time the user clicks on the menu item.&#160;</pre>
<pre> I tried performing a &#39;clearGridData&#39;, that didn&#39;t work either.  How can I get the grid to reload with new&#160;</pre>
<pre>parameters?</pre>
<pre>Thanks!</pre>
<pre>                    try {
                        $incidentGrid.jqGrid(&#39;GridUnload&#39;);
                    }
                    catch (e) {
                        alert(e.message);
                    }

                    $incidentGrid.jqGrid({
                        postData: { &#39;CSID&#39;: CSID, &#39;FolderId&#39;: folderId },
                        ajaxGridOptions: { cache: false },
                        datatype: function (pdata) {
                            var s = (pdata.page - 1) * pdata.rows;
                            var e = pdata.rows;
                                try {
                                    $incidentGrid.block({ message: BusyMsg });

                                    PageMethods.ReadIncidents(pdata.CSID, &#39;&#39;, pdata.FolderId, s, e, function (data, context, methodName) {
                                        var dataObj = {};
                                        try {
                                            dataObj = eval(&#39;(&#39; + data + &#39;)&#39;);
                                        }
                                        catch (e) {
                                            $.writeMessage(&#39;Could not parse table data.&#39; + e.message);
                                            return;
                                        }

                                        try {
                                            if (context &#38;&#38; context.addJSONData)
                                                context.addJSONData(dataObj);
                                        }
                                        catch (e) {
                                            $.writeMessage(e.message);
                                        }
                                        finally {
                                            $(context).unblock();
                                        }
                                    },
                                    function (error, context, methodName) {
                                        $.writeMessage(error.get_message());
                                        $(context).unblock();
                                    }, this);
                                }
                                catch (e) {
                                    $.writeMessage(e.message);
                                    $incidentGrid.unblock();
                                }
                        },
                        colNames: [&#39;Id&#39;, &#39;Description&#39;, &#39;Date Created&#39;, &#39;Date Modifed&#39;, &#39;Created By&#39;, &#39;CSID&#39;, &#39;wId&#39;],
                        colModel: [
                            { name: &#39;id&#39;, index: &#39;id&#39;, sortable: false, width: 50 },
                            { name: &#39;desc&#39;, index: &#39;desc&#39;, sortable: false },
                            { name: &#39;dCreated&#39;, index: &#39;dCreated&#39;, sortable: false },
                            { name: &#39;dModified&#39;, index: &#39;dModified&#39;, sortable: false },
                            { name: &#39;cBy&#39;, index: &#39;cBy&#39;, sortable: false },
                            { name: &#39;CSID&#39;, index: &#39;CSID&#39;, sortable: false, hidden: true },
                            { name: &#39;wId&#39;, index: &#39;wId&#39;, sortable: false, hidden: true }
                        ],
                        jsonReader: {
                            root: &#39;data&#39;,
                            page: &#39;page&#39;,
                            total: &#39;total&#39;,
                            records: &#39;records&#39;,
                            cell: &#39;row&#39;,
                            id: &#39;id&#39;
                        },
                        gridview: true,
                        pager: &#39;#tblJqGridPager&#39;,
                        viewrecords: true,
                        sortable: false,
                        viewsortcols: [false, &#39;vertical&#39;, false],
                        ExpandColClick: false,
                        shrinkToFit: true,
                        autowidth: true,
                        height: 230,
                        rowNum: 10,
                        onSelectRow: function (id, status, e) {
                            var data = $incidentGrid.jqGrid(&#39;getRowData&#39;, id);
                            var childWindow = null;
                            var eid = data.id;

                            $.each(landingJS.windows, function (i, v) {
                                if (v.EID + "" == eid) {
                                    childWindow = v;
                                    return false;
                                }
                            });

                            if (childWindow) {
                                landingJS.focus(childWindow.id);
                                return;
                            }

                            var c = landingJS.launchWindow(data.wId, data.CSID, eid, data.desc, [{ &#39;key&#39;: &#39;IncidentId&#39;, &#39;value&#39;: eid }, { &#39;key&#39;: &#39;CSID&#39;, &#39;value&#39;: data.CSID}], false);
                        },
                        gridComplete: function () {
                            var rows = $(&#39;#tblJqGrid .ui-row-ltr&#39;);

                            if (rows &#38;&#38; rows.length &#62; 0)
                                $.each(rows, function (k, v) {
                                    var $v = $(v);
                                    if (!$v)
                                        return true; //skip

                                    var id = $.ToInt($v.attr(&#39;id&#39;), 0);

                                    if (id &#62; 0) {
                                        if (!$v.data(&#39;draggable&#39;)) $v.draggable();

                                        $v.draggable(&#39;option&#39;, {
                                            cursor: &#39;pointer&#39;,
                                            appendTo: &#39;body&#39;,
                                            cursorAt: {
                                                top: 0,
                                                left: 0
                                            },
                                            start: function (e, ui) {
                                                $(this).parent().fadeTo(&#39;fast&#39;, 0.5);
                                            },
                                            stop: function (e, ui) {
                                                $(this).parent().fadeTo(0, 1);
                                            },
                                            helper: function (e) {
                                                var e = $(this);
                                                var id = e.prop(&#39;id&#39;);
                                                var dragView = $(&#39;dragging&#39;);

                                                $(&#39;TD&#39;, dragView).each(function () {
                                                    $(this).attr(&#39;nowrap&#39;, &#39;nowrap&#39;);
                                                });

                                                return dragView;
                                            }
                                        });
                                    }
                                });


                            this.setGridWidth(layout.state.center.innerWidth).trigger(&#39;resize&#39;);
                        }
                    });
</pre>
]]></description>
        	        	<pubDate>Fri, 04 Jan 2013 18:13:00 +0200</pubDate>
        </item>
</channel>
</rss>