EasyUI Forum
April 29, 2024, 12:41:52 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: 1 2 [3]
31  General Category / General Discussion / Re: set url combogrid in datagrid editor by selected other combogrid or filter data on: April 09, 2016, 01:24:33 PM
Hi,
thank you for solution,
i have try your sugestion but it still not work for me  Sad

Code:
 <table id="dg2"  title="" style="width:790px;height:250px"
toolbar="#toolbar" data-options="singleSelect:true,pageList:[100],pageSize:100" pagination="false" idField="trandetailid"
rownumbers="true" fitColumns="true" >
<thead>
<tr>
<th field="btno" width="20" editor="{type:'combogrid',options:{required:true,panelWidth:580,idField:'btno',textField:'btno',mode:'remote',columns: [[
{field:'btno',title:'Product No',width:100},
{field:'productdescription',title:'Product Description',width:350},
{field:'harga',title:'Unit Price',width:80,formatter:formatPrice},
]],url:'./control/list_product.php',
onBeforeLoad:onBeforeLoad,
onSelect: onSelectGrid,
onShowPanel: onShowPanel,
onHidePanel: onHidePanel,}}">Product No</th>
<th field="productdescription" width="50" editor="{type:'text',options:{required:true}}">Product Description</th>
<th field="qty"   width="30" editor="{type:'numberbox',options:{required:true,precision:0,onChange:onChangeCell}}">Quantity</th>
<th field="unit_price"  width="20" formatter="formatPrice" editor="{type:'numberbox',options:{required:true,precision:0,onChange:onChangeCell}}">Unit Price</th>
<th field="subtotal"   width="40" formatter="formatPrice" editor="{type:'numberbox',options:{required:true,precision:0,onChange:onChangeCell}}">Sub Total</th>
</tr>
</thead>
</table>
<script>
function getValue(){
       valurl = $('#customer').combogrid('getValue');
         
  }
 
function getRowIndex(target) {
var tr = $(target).closest('tr.datagrid-row');
return parseInt(tr.attr('datagrid-row-index'));
}
var cbg=null;
var tb=null;
function onSelectGrid(index,record) {
if(cbg) {
var cb = cbg;
var opts =cb.combogrid('options');
var grid = cb.combogrid('grid');
var row= grid.datagrid('getSelected');
// alert (row.material_name);
var dg2 = $('#dg2');
var index = dg2.datagrid('getRowIndex', dg2.datagrid('getSelected'));
// var index = $('#dg2').datagrid('getSelected');
//alert (index);


var editors = dg2.datagrid('getEditors', index);
//var vl= $(editors[0].target).combogrid('getValue');
//alert (vl);
$(editors[1].target).val(row.productdescription);
//$(editors[2].target).val(row.Unit);
$(editors[3].target).val(row.harga);


}
}


function onBeforeLoad(param){

var opts = $(this).datagrid('options');
opts.url ="./control/list_product.php?customerid="+valurl;
alert (opts.url);
}

function onShowPanel() {
cbg = $(this);

}
function onHidePanel() {
cbg = null;
}

</script>



Best Regards

Shiva
32  General Category / General Discussion / set url combogrid in datagrid editor by selected other combogrid or filter data on: April 09, 2016, 12:04:42 AM
hello all,

i have some problem with filter data combogrid as editor in datagrid, for schema i have 2 combogrid one as main, this combo used as filter data for other combogrid in side datagrid as editor. i have try some solution but still not work this is my code :

Code:
<select id="customer" class="easyui-combogrid" style="width:250px" data-options="
            panelWidth: 500,
            idField: 'customerid',
            textField: 'customername',
            url: './control/get_customer.php',
            columns: [[
                {field:'customername',title:'Customer',width:120},
            ]],
onSelect:getValue,
            fitColumns: true
        ">
    </select>

 <table id="dg2"  title="" style="width:790px;height:250px"
toolbar="#toolbar" data-options="singleSelect:true,pageList:[100],pageSize:100" pagination="false" idField="trandetailid"
rownumbers="true" fitColumns="true" >
<thead>
<tr>
<th field="customerid" width="20" editor="{type:'combogrid',options:{required:true,panelWidth:580,idField:'btno',textField:'btno',mode:'remote',url:'./control/list_product.php',columns: [[
{field:'btno',title:'Product No',width:100},
{field:'productdescription',title:'Product Description',width:350},
{field:'harga',title:'Unit Price',width:80,formatter:formatPrice},
]], onSelect: onSelectGrid,
onShowPanel: onShowPanel,
onHidePanel: onHidePanel,}}">Product No</th>
<th field="productdescription" width="50" editor="{type:'text',options:{required:true}}">Product Description</th>
<th field="qty"   width="30" editor="{type:'numberbox',options:{required:true,precision:0,onChange:onChangeCell}}">Quantity</th>
<th field="unit_price"  width="20" formatter="formatPrice" editor="{type:'numberbox',options:{required:true,precision:0,onChange:onChangeCell}}">Unit Price</th>
<th field="subtotal"   width="40" formatter="formatPrice" editor="{type:'numberbox',options:{required:true,precision:0,onChange:onChangeCell}}">Sub Total</th>
</tr>
</thead>
</table>




Thanks for help

Best Regards

Shiva
33  General Category / EasyUI for jQuery / Re: Use Pagination event on datagrid on: June 29, 2015, 06:47:24 PM
OK, Thanks for your solution it works great..., but why we can not do it from pagination event?
34  General Category / EasyUI for jQuery / Re: Use Pagination event on datagrid on: June 29, 2015, 06:23:56 PM
Hi, after I analyze your code and my code difference is in "this" at onSelectPage. but if i add "this" at onSelectPage my code datagrid selectRow and other code not working. but if i remove "this" from code my code is working but my data at datagrid header still on first page not move to actual page so my datagrid detail show data my first page not my second page data.

Code:
		$(function(){
var pager = $('#dg').datagrid('getPager'); // get the pager of datagrid
pager.pagination({
//onBeforeRefresh:function(){
// alert('before refresh');
// return true;
// }
onSelectPage:function(pageNumber, pageSize){
//$(this).pagination('loading');
//alert('pageNumber:'+pageNumber+',pageSize:'+pageSize);
//$(this).pagination('loaded');
$('#dg').datagrid('selectRow',0);
onClickRow()
}

});

});

35  General Category / EasyUI for jQuery / Re: Use Pagination event on datagrid on: June 29, 2015, 02:06:37 AM
i have try your code but it don't have any effect when i try to change pagination record. i try to combine it with my code like this :
Code:

var dg = $('#dg');
var pager = dg.datagrid('getPager');
var popts = pager.pagination('options');
var onSelectPage = popts.onSelectPage;
popts.onSelectPage = function(pageNumber, pageSize){
    onSelectPage.call(this, pageNumber, pageSize);
$('#dg').datagrid('selectAll');
    onClickRow()
}

36  General Category / EasyUI for jQuery / Re: Inline Modify data on datagrid on: June 29, 2015, 01:45:51 AM
Ok, Thanks i was find it. this topic Closed..
37  General Category / EasyUI for jQuery / Re: Inline Modify data on datagrid on: June 29, 2015, 01:21:05 AM
Thanks for reply,your code for index work perfectly but i'm not use all of your code and combine it with my previous code where use datagrid update event. but now i have little problem after update event, combogrid still open after update even i try to refresh datagrid. Could you give me sugestion here my new code:

Code:

function getRowIndex(target) {
var tr = $(target).closest('tr.datagrid-row');
return parseInt(tr.attr('datagrid-row-index'));
}
var cbg=null;
var tb=null;
function onSelectGrid(index,record) {
if(cbg) {
var cb = cbg;
var opts =cb.combogrid('options');
var grid = cb.combogrid('grid');
var row= grid.datagrid('getSelected');
// alert (row.material_name);
var dg = $('#dg2');
var index = dg.datagrid('getRowIndex', dg.datagrid('getSelected'));
// var index = $('#dg2').datagrid('getSelected');
//alert (index);



//$(target).val(row.material_name);

$('#dg2').datagrid('updateRow',{
index: index,
row: {
card_no: row.card_no,
material_name: row.material_name,
Unit:row.Unit,
accbiaya:row.account_code,
}
});
$('#dg2').datagrid('reload');
}
}

function onShowPanel() {
cbg = $(this);

}
function onHidePanel() {
cbg = null;
}

38  General Category / EasyUI for jQuery / Use Pagination event on datagrid - Closed on: June 28, 2015, 11:01:32 PM
Hi,

can someone help me please.., i have problem with use pagination event at datagrid. i want to use pagination to refresh another datagrid, i use two datagrid in my design  first as header and second as detail, i want to use pagination at my first datagrid to refresh data at my second datagrid, i have try event at pagination datagrid and it work perfectly when pagination fires but data won't change only number of pagination.

Here My Script:

Code:
<script>
$(function(){
var pager = $('#dg').datagrid('getPager'); // get the pager of datagrid
pager.pagination({

onSelectPage:function(pageNumber, pageSize){

onClickRow()
}

});

});



 function onClickRow(){
    var row = $('#dg').datagrid('getSelected');
    if (row){
    //alert(row.voucher_id);
//document.getElementById("detail_id").value = row.voucher_id;
$('#dg1').datagrid({
      url:'./control/getdata_detail.php?voucher_id=' + row.voucher_id});
 //get total value
 var string = "voucher_id="+row.voucher_id
$.ajax({
type : 'POST',
url : "./control/ff2.php",
data : string,
cache : false,
success : function(data){
//var win = $.messager.progress({
//title:'Please waiting',
//msg:'Loading data...'
//});
setTimeout(function(){
$.messager.progress('close');
$("#p3").html(data);
//alert("Data: " + string );
},100)
}
});
    }
}

</script>  
39  General Category / EasyUI for jQuery / Inline Modify data on datagrid - Closed on: June 28, 2015, 05:30:33 PM
Hi, can somebody help me

i have problem with inline editing on datagrid, in my design i take a combogrid and some textbox at datagrid, i have plan to update my textbox with data on selection event combogrid. i successfully when update my first row data but when i fill second row data, my first row data also change with my second row data.



here my code for datagrid design:
Code:

<table id="dg2"  title="" style="width:700px;height:250px"
toolbar="#toolbar" data-options="singleSelect:false,pageList:[100],pageSize:100" pagination="false" idField="trandetailid"
rownumbers="true" fitColumns="true" >
<thead>
<tr>
<th field="card_no" width="50" editor="{type:'combogrid',options:{required:true,panelWidth:580,idField:'card_no',textField:'card_no',mode:'remote',url:'./control/card.php',columns: [[
{field:'card_no',title:'Card No',width:100},
{field:'material_name',title:'Material Name',width:350},
{field:'Unit',title:'Unit',width:30},
{field:'account_code',title:'Kode Kartu',width:100}
]], onSelect: onSelectGrid,
onShowPanel: onShowPanel,
onHidePanel: onHidePanel,}}">Card No</th>
<th field="material_name" width="50" editor="{type:'text',options:{required:true}}">Material Description</th>
<th field="Unit"    width="20" editor="text" >Unit</th>
<th field="quantity"   width="30" editor="text">Quantity</th>
<th field="accbiaya"   width="40" editor="text">Kode Kartu</th>
</tr>
</thead>
</table>
and here my script code:
Code:
			function getRowIndex(target) {
var tr = $(target).closest('tr.datagrid-row');
return parseInt(tr.attr('datagrid-row-index'));
}
var cbg=null;
var tb=null;
function onSelectGrid(index,record) {
if(cbg) {
var cb = cbg;
var opts =cb.combogrid('options');
var grid = cb.combogrid('grid');
var row= grid.datagrid('getSelected');
//alert (row.material_name);
var index = $('#dg2').datagrid('getSelected');
//alert (index);
//$(target).val(row.material_name);

$('#dg2').datagrid('updateRow',{
index: index,
row: {
card_no: row.card_no,
material_name: row.material_name,
Unit:row.Unit,
accbiaya:row.account_code,
}
});
$('dg2').datagrid('reload');
}
}
function onShowPanel() {
cbg = $(this);

}
function onHidePanel() {
cbg = null;
}
Pages: 1 2 [3]
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!