Title: PropertyGrid / DataGrid - How to Use the URL property to retrieve data from PHP Post by: tenly on July 11, 2015, 07:30:28 AM I am extremely new to EasyUI and to Web Development in general so forgive me if this question is obvious to most people. I've been stuck on this issue for 2-3 weeks and am finally ready to admit I need help.
I am having problems populating datagrid and propertygrid's using the 'url:""' parameter. My workaround until now was to use the 'data: propgrid' method instead of the url method. This of course requires me to create and populate the variable using PHP at page load time and that to refresh the data, I have to refresh the entire page. (very undesirable!) I use a Powershell script on the back end which interfaces with a number of systems to collect the information I want to display. The powershell script produces JSON-formatted output. I want to be able to click a button on my page which creates the property grid and uses the URL property to invoke a .php script to invoke the powershell script to collect the data. Code: function addpg() { I've tried a million variations of this and for the life of me I can't get it to work when trying to generate the data 'live'. It just fails silently. If I mis-type the propgrid.php, i can see in the console.log that a 404 error is generated (so I know it is being called), but if everything is spelled correctly, I get no error - and also no data displayed. This mechanism works fine if I change it to: Code: url: 'propgrid_data.json' For sake of an example; One of the property grids is meant to display a list of Windows Services running on a remote server and the status of each (ie: Stopped, Running, StartPending, etc). Powershell collects the information in an object, and I generate the output from that object with something like: Code: $comma=",`r`n" After many failures, I added a line after the loop to save a copy of my output to disk: Code: $outfile|set-content "C:\Apache24\htdocs\testing\propgrid_data.json" The content of the .json file is identical to the results returned by the PHP page however; - the grid is populated correctly if I set url to look directly to the .json file, but - the grid does NOT get populated if I set it to use the .php file I've verified that the lines end with crlf in both the web-page and the file. I've tried adding the <html> and <body> tags to the html output and I've tried just generating the raw output with no html elements. I've confirmed that the encoding of the file and the web-page output are both UTF-8. Here is a sample of how my .json file looks and also how the output from invoking the .php file looks. If I retrieve both via the web-browser and choose 'View Source', the results are identical. Code: [ Please help! |