EasyUI Forum
November 05, 2025, 12:38:36 AM *
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 / EasyUI for jQuery / Re: questions on ComboGrid on: May 05, 2013, 04:43:45 PM
Stworthy,
Thanks for point that out I totally missed that. 

Thanks
Jon
2  General Category / EasyUI for jQuery / Re: questions on ComboGrid on: May 03, 2013, 03:21:58 AM
stworthy,
Thank you for responding.  I replaced the input name but it will not pass the value to the input still, when I look at it in Firefox the post still show just like the picture above.  How can I pass the values from the combogrid to the form probably would be the better question.  I am new to this gird use.
What I am trying is to pick Code Number from New Code Violation combogrid and then would like for the Code Number and Description to populate the form.  Description > Form Description. 

Thanks
Jon
3  General Category / EasyUI for jQuery / questions on ComboGrid on: May 02, 2013, 11:03:48 AM
I have been working with the combo grid and what I am trying to accomplish is this:
I have a data grid and I used to demo as a template which works the problem is when I bring up a new entry form to enter data into the data grid I need for one of the inputs to be a combo grid of which I have gotten to work.  My problem is that when the submit of the form is processed the value of the combogrid is not saving what was selected.  The other question i have is can the selection of the combogird that has three fields in it populate another input field.

So when the id is selected the id and the description is both saved into the datagrid on refresh.  
Code:
<div id="comments"><p>Comments</p>
<table id="dg" title="Code Violations" class="easyui-datagrid" style="width:700px;height:250px"
url="get_violations.php?id1=<?php echo $detail_inspection['id1']?>"
toolbar="#toolbar" pagination="true"
rownumbers="true" fitColumns="true" sigleSelect="true">
<thead>
<tr>
<th field="code_number" width="50">Code Section</th>
<th field="code_description" width="300">Description</th>
 </tr>  
</thead>
</table>
<div id="toolbar">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newViolation()">New Violation</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editViolation()">Edit Violation</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="removeViolation()">Remove Violation</a>
</div> <!--end toolbar div-->
<div id="dlg" class="easyui-dialog" style="width: 500px; height:200px; padding:10px 20px"
closed="true" buttons="#dlg-buttons">

form
Code:
<div class="ftitle">Code Violations</div>
<form id="fm" method="post" novalidat>
<div class="fitem">
<input id="inspectionId"  name="inspectionId"/> <br/>
<label>Code Number</label>
<!--<input name="code_number" class="easyui-validatebox" required="true">-->
<input id="cc" name="cc"/>
</div>
<div class="fitem">
<label>Description</label>
<input name="description" class="easyui-validatebox" required="true">
</div>
</form>

Script
Code:
<script type="text/javascript">
var url;
function newViolation(){
$('#dlg').dialog('open').dialog('setTitle','New Code Violation');
$('#fm').form('clear');
url = 'save_violation.php';
}
function editViolation(){
var row = $('#dg').datagrid('getSelected');
if (row){
$('#dlg').dialog('open').dialog('setTitle','Edit Violation');
$('#fm').form('load', row);
url = 'update_Violation.php?id='+row.id;
}
}
function saveViolation(){
$('#fm').form('submit',{
url: url,
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
var result = JSON.parse(result);

if (result.success){

$('#dlg').dialog('close');//closes the dialog window
$('#dg').datagrid('reload');// reload the violations
}else{
$.messager.show({
title:'Error',
msg: result.msg
});
}
}
});
}
function removeViolation(){
var row = $('#dg').datagrid('getSelected');
if (row){
$.messager.confirm('Confirm','Are you sure you want to remove this Violation?', function(r){
if (r){
$.post('remove_vailation.php',{id:row.id}, function(result){
if(result.success){
$('#dg').datagrid('reload');// reload the violation data
}else{
$.messager.show({// show error message
title: 'Error',
msg: result.msg
});
}
},'json');
}
});
}
}
<script>
$(function(){
$('#cc').combogrid({
panelWidth:500,
url: 'get_codes.php',
idField: ' id_code_violations',
textField: 'code_number',
mode:'remote',
fitColumns:true,
columns:[[
{field:'id_code_violation',title:'No.',width:25},
{field:'code_number', title:'Code Number', width: 100},
{field:'code_description', title:'Description', width: 400}
]]
});

$("input [name='mode']").change(function(){
var mode = $(this).val();
$('#cc').combogrid({
mode:mode
});
});
});


</script>
Pictures showing problems where the code_number from the combo grid is not posting the id number that is selected

Any amount of help will be greatly appreciated
4  General Category / EasyUI for jQuery / Re: problem not display of value on: April 22, 2013, 05:38:03 PM
I removed the class from the HTML, it is a combogrid and I can't get the value to of the combogrid pass to the form for input.  When it updates the database it is empty.  Any thought.

Thank you for the reply.

Jon
5  General Category / EasyUI for jQuery / problem not display of value on: April 19, 2013, 06:13:39 PM
I am having a problem with a combogrid in a form.  What I am doing is to have a drop down selection box and then pass the value to a form to pass to php form.  I can get the drop down combogrid to display but it will not save the value into the database.

Form code:
Code:
<div id="dlg" class="easyui-dialog" style="width: 500px; height:200px; padding:10px 20px"
                                closed="true" buttons="#dlg-buttons">
                                    <div class="ftitle">Code Violations</div>
                                    <form id="fm" method="post" novalidat>
                                        <div class="fitem">
                                        <input id="inspectionId"  name="inspectionId"/>                                            <label>Code Number</label>
                                            <!--<input name="code_number" class="easyui-validatebox" required="true">-->
                                            <input id="cc" class="easyui-combobox" name="code_number"/>
                                            </div>
                                        <div class="fitem">
                                            <label>Description</label>
                                            <input name="description" class="easyui-validatebox" required="true">
                                        </div>
                                    </form>
script code for combogrid:
Code:
<script>
$(function(){
$('#cc').combogrid({
panelWidth:500,
url: 'get_codes.php',
idField: ' id_code_violations',
textField: 'code_number',
mode:'remote',
fitColumns:true,
columns:[[
{field:'id_code_violation',title:'No.',width:25},
{field:'code_number', title:'Code Number', width: 100},
{field:'code_description', title:'Description', width: 400}
]]
});
$("input [name='mode']").change(function(){
var mode = $(this).val();
$('#cc').combogrid({
mode:mode
});
});
});

</script>[/code
Script to process the save/edit/remove:
[code]            <script type="text/javascript">
var url;
function newViolation(){
$('#dlg').dialog('open').dialog('setTitle','New Code Violation');
$('#fm').form('clear');
url = 'save_violation.php';
}
function editViolation(){
var row = $('#dg').datagrid('getSelected');
if (row){
$('#dlg').dialog('open').dialog('setTitle','Edit Violation');
$('#fm').form('load', row);
url = 'update_Violation.php?id='+row.id;
}
}
function saveViolation(){
$('#fm').form('submit',{
url: url,
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
var result = eval('('+result+')');
if (result.success){

$('#dlg').dialog('close');//closes the dialog window
$('#dg').datagrid('reload');// reload the violations
}else{
$.messager.show({
title:'Error',
msg: result.msg
});
}
}
});
}
function removeViolation(){
var row = $('#dg').datagrid('getSelected');
if (row){
$.messager.confirm('Confirm','Are you sure you want to remove this Violation?', function(r){
if (r){
$.post('remove_vailation.php',{id:row.id}, function(result){
if(result.success){
$('#dg').datagrid('reload');// reload the violation data
}else{
$.messager.show({// show error message
title: 'Error',
msg: result.msg
});
}
},'json');
}
});
}
}
</script>

php code to save:
Code:
<?php 
include 'init.php';
$inspID $_REQUEST['inspectionId'];
$codeNumber $_REQUEST['code_number'];
$description $_REQUEST['description'];

$sql "INSERT into code_violation(inspectionId,code_number, code_description) 
VALUES ('
$inspID','$codeNumber','$description')";
$result = @mysql_query($sql);
if (
$result){
echo json_encode (array('success'=>true));
}else{
echo json_encode (array('msg'=>'some errors occured.'));
}
?>

Please I need help to understand what the problem is.

Thank You[/code]
6  General Category / EasyUI for jQuery / Print grid on: April 17, 2013, 06:05:14 PM
Can anyone guide me to how to print a grid table, as well is there any demos of how to add a select box that receives the data from a database. 
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!