EasyUI Forum
May 15, 2024, 08:56:51 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: combo box text values disappear on refresh inside a grid  (Read 3903 times)
wel
Newbie
*
Posts: 30


View Profile Email
« 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.
« Last Edit: January 06, 2016, 07:31:03 PM by wel » Logged
wel
Newbie
*
Posts: 30


View Profile Email
« Reply #1 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 ?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!