EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: wel on January 06, 2016, 07:21:20 PM



Title: combo box text values disappear on refresh inside a grid
Post by: wel on January 06, 2016, 07:21:20 PM
I added a combo box inside a grid like this

Code:
<th data-options="field:'job_type_id',width:10,
                                    formatter:function(value,row){
                                        return row.job_type;
                                    },
                                    editor:{
                                        type:'combobox',
                                        options:{
                                            valueField:'job_type_id',
                                            textField:'job_type',
                                            method:'get',
                                            url:'pages/job_types.json',
                                            required:true
                                        }
                                    }">Job Type
                                </th>

The insert and update work normally in the database but when I refresh the page all the combo box text values disappear !!

Here are the json data

Code:
[{
  "job_type_id":1,
  "job_type":"Stat"
},{
  "job_type_id":2,
  "job_type":"Today"
},{
  "job_type_id":3,
  "job_type":"Time"
}
]

The formatter function is correct so what is the problem ? please advise.


Title: Re: combo box text values disappear on refresh inside a grid
Post by: wel on January 07, 2016, 08:40:36 AM
I found the problem the url page is like this

Code:
<script type="text/javascript">
        $(function(){
            $('#dg').edatagrid({
                url: 'pages/get_jobmsg.php',

And the SQL
Code:
$q = $conn->prepare("select * from job_messages");
$q->execute();

$result = $q->fetchAll();
echo json_encode($result);

only include job_type_id so job_type does not exists I have now to create table for job_type to use database join but is there a way to use json data inside combo box with database data inside a grid ?