EasyUI Forum
October 18, 2025, 03:14:39 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  General Category / General Discussion / Combobox that is not Editable, but can be selected. on: October 26, 2015, 09:43:26 AM
I want to make the combobox so that you can use as a dropbox and select an item, but the issue is that this combobox allows you to enter in your own field and option and save that.  I was to restrict options and I want people to select Illinois, not enter in IL in the combobox.  Editable false doesn't work, just makes where I can not select the dropdown.
2  General Category / EasyUI for jQuery / Re: XML data load on: December 03, 2013, 08:24:58 AM
I also answered this on Stack Overflow.

I started with the CRUD datagrid tutorial version so my answer might be a bit different. I started from the CRUD example, converting from the mySQL solution to instead use XML.
http://www.jeasyui.com/tutorial/app/crud2.php

$(function(){
        $('#dg').edatagrid({
            url: 'get_data.php' /* pulls in the data from a xml file  */
        });
    });
My example actually had the read (url), create (saveURL), update (updateURL), and delete (destroyUrl) but for this answer I just put the url to read the data in.

For my get_data.php I converted my XML file into JSON. I also removed a root I had in that XML file.

if(!$xml = simplexml_load_file("mydata.xml", null, LIBXML_NOCDATA)) {
echo "unable to load file";
}
{
$xmlarray = array();  // create a new array
    foreach ($xml as $element) {  // loop through the xml file elements
        array_push($xmlarray, $element);  // push the elements on the xml array
    }
}

echo json_encode($xmlarray);  // encode that json without the root xml element

I am still sticking with simplexml, there are easier ways to do this when you get into removing and updating.
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!