Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>While I was playing around with this control I managed to do this in order to add the query later but also keep the sort, search and paging working with the same code.</p> <pre><code>jQuery(document).ready(function () { //AUTO FILL THE OFFERS GRID jQuery("#OFFERS").flexigrid({ url: 'index.php?option=com_virtuemart&amp;view=offers&amp;task=getOffers&amp;page=1&amp;format=raw', dataType: 'json', singleSelect: true, colModel: [{ display: 'id', name: 'id', width: 100, sortable: true, align: 'center' }, { display: 'startdate', name: 'startdate', width: 180, sortable: true, align: 'center' }, { display: 'enddate', name: 'enddate', width: 180, sortable: true, align: 'left' }, { display: 'product_name', name: 'product_name', width: 120, sortable: true, align: 'left' }, { display: 'discount_amount €', name: 'discount_amount', width: 100, sortable: true, align: 'left' }, { display: 'discount_percent %', name: 'discount_percent', width: 120, sortable: true, align: 'right' }], searchitems: [{ display: 'startdate', name: 'startdate', isdefault: true }, { display: 'enddate', name: 'enddate' }, { display: 'product_name', name: 'product_name' }, { display: 'discount_amount', name: 'discount_amount' }, { display: 'discount_percent', name: 'discount_percent' }], sortname: "id", sortorder: "asc", usepager: true, title: 'Offer', useRp: true, rp: 15, showTableToggleBtn: true, width: 900, onSubmit: addFormData, height: 200, buttons: [{ name: 'Testfunc1', onpress: testfunc1 }] }); //JUST CREATE THE PRODUCTS GRID jQuery("#pnlProducts").flexigrid({ dataType: 'json', singleSelect: true, colModel: [{ display: 'id', name: 'id', width: 100, sortable: true, align: 'center' }, { display: 'name', name: 'name', width: 180, sortable: true, align: 'center' }, { display: 'price', name: 'price', width: 180, sortable: true, align: 'left' }], searchitems: [{ display: 'id', name: 'id', isdefault: true }, { display: 'name', name: 'name' }, { display: 'price', name: 'price' }], sortname: "id", sortorder: "asc", usepager: true, title: 'Products', useRp: true, rp: 15, showTableToggleBtn: true, width: 900, onSubmit: addFormData, height: 200, buttons: [{ name: 'Testfunc2', onpress: testfunc2 }] }); jQuery("#LoadProducts").click(function () { //MANUALLY FILL THE PRODUCT GRID START //But Search,Sort,Paging wont work /*jQuery.ajax({ type: "POST", url: "index.php?option=com_virtuemart&amp;view=offers&amp;task=getProducts&amp;page=1&amp;rp=18&amp;sortname=name&amp;sortorder=asc&amp;query=&amp;qtype=name&amp;format=raw", dataType: 'json', cache: false }).done(function(data) { //alert(data); jQuery("#tblProducts").flexAddData(data); });*/ //And this will keep the sort,search,paging working jQuery('#tblProducts').flexOptions({ url: 'index.php?option=com_virtuemart&amp;view=offers&amp;task=getProducts&amp;page=1&amp;rp=18&amp;sortname=name&amp;sortorder=asc&amp;query=&amp;qtype=name&amp;format=raw' }).flexReload(); }); }); </code></pre> <p>And I add a button to execute the call to the controler</p> <pre><code> &lt;input type="button" id="LoadProducts" value="Load The product grid" &gt; </code></pre> <p>But I still don't know how to chain load the flexigrids without hurting the sort,search,paging events</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload