We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22019
    • 390 Posts
    Background - I have next to know knowledge of MODExt / javascript in general. I am hacking Bruno’s Xdbedit package to suit my needs, and I can figure out how to change columns in a basic grid, add new buttons etc, and alter the functions already there. I struggle to write new functions though.

    I have a dataset that I want to the client to be able to download. He’s already looking at a grid of the data in a MODx CMP, but now he wants to be able to take records and fiddle with them in Excel.

    Separately, I have a PHP script that uses a MODx object and modFile to create a file, and then the PHP readfile to force a download from the browser.

    But I don’t know how to hook up the two in the CMP. I’d love a button, but I’m willing to settle for a link - seeing as I already have a PHP process. But I can’t work out how to add a ’normal’ HTML link to the sections/panels/grids of the CMP. So far, all I can do is trigger a file creation of the selected records (which is nice) but it doesn’t clear the selection on success, or output to the browser, so I know it’s not working ’properly’.

    Any ideas?

    EDIT - For now, I’ve added an action the menu instead, with a handler of
    window.open("http://my php file location");
    . I’ll put it on the to-learn pile.
      Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86