Show Posts
|
Pages: [1] 2
|
7
|
General Category / EasyUI for jQuery / Re: Changing the datagrid url based on input radio selection
|
on: October 14, 2014, 11:24:35 AM
|
$("li").on("click", "input", function() { $('#dg').datagrid('reload'); // add = $(this).text().val(); globalVar = $(this).val(); });
$('#dg').datagrid({ url: 'lists.php', queryParams: { ltype: globalVar } }); Ok but can you tell me how to pass the globalVal to query param? And wont it be static? When I press the checkboxe's will it reload the grid - supposingly no.
|
|
|
8
|
General Category / EasyUI for jQuery / e.preventDefault(); in tree node?
|
on: October 14, 2014, 10:14:52 AM
|
onClick: function(node){ alert(node.text); // alert node text property when clicked $.get( $(this).attr('href'), function(data) { $('#te').html(data); } ); } I got such code, and I wan't to disable in the node the <a> tag - normally it works with e.preventDefault(); but it seems like it can't be added here. Its because I have a formatter for the tree if (node.text > 0){ return '<a class=clicker href=logs/'+node.text+'/' + node.text + '.log>' + node.text + '</a>';}
|
|
|
10
|
General Category / EasyUI for jQuery / [Solved] Changing the datagrid url based on input radio selection
|
on: October 14, 2014, 07:23:53 AM
|
<div class="adv_filter"> <li> <input type="radio" name="letter_type" data-custom="Option1" value="0"> Option1 </li><li> <input type="radio" name="letter_type" data-custom="Option2" value="1" checked="checked"> Option2 </li><li> <input type="radio" name="letter_type" data-custom="Option3" value="2"> Option3 </li> </div> var url = 'lists.php?ltype='+input_radio_value; $("li").on("click", "input", function() { $('#dg').datagrid('reload'); // add = $(this).text().val(); globalVar = 'lists.php?ltype='+$(this).val(); }); This onclick function gets the Option1 name only, but I want to get the value thats the first thing. The second this is to override the url with the ?=ltype value, is this even possible? I got in my lists.php $_GET for ltype and everything properly configurated, manually inserting the value works but I want to be able to do it when I select a radio . But basically I have no idea how to accomplish this. How to get the globalVar isnide $('#dg').datagrid({ url : url, SOLVED AT : http://stackoverflow.com/questions/26387676/passing-a-variable-into-an-other-function-jeasyui
|
|
|
11
|
General Category / EasyUI for jQuery / Cannot read property 'options' of undefined in window
|
on: October 13, 2014, 06:50:15 AM
|
The thing is on other page it work's somehow it doesn't want work in this example. The window shows under the table. After clicking newUser() on a button the error appears <table id="dgin" style="height:430px;" url="listsinner.php?list=<?PHP echo $itemid; ?>" pagination="true" sortName="created" sortOrder="desc" title="Podgląd list" singleSelect="true" toolbar="#tbin" collapsible="true"> <thead> <tr> <th field="id" width="150px;" sortable="true">#ID</th> <th field="Number" width="350px;" sortable="true">Numer wpisu</th> <th field="date" sortable="true">Data utworzenia</th> <th field="rdate" sortable="true">Data rozliczenia</th> <th field="return" sortable="true">Status</th> <th field ="detail" formatter="formatDetail">Akcje</th> </tr> </thead> </table> <div id="dlg" class="easyui-window" style="width:400px;height:280px;padding:10px 20px" closed="true" buttons="#dlg-buttons"> <form id="fm" method="post" validate=""> <div class="col-md-12"> <div class="login-panel panel panel-default"> <div class="panel-heading"> <h1 class="panel-title">Dodawanie nowego wpisu</h1> </div>
<div class="form-group"> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-list-alt"></i></span> <input type="text" name="list" class="form-control" disabled placeholder="<?PHP echo $itemid; ?>"> </div> </div> <div class="form-group"> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-list-alt"></i></span> <input type="text" name="item" required="true" class="form-control" placeholder="Numer do dodania"> </div> </div> </div> </div>
</form>
<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;"> <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="saveEntry()" style="width:80px">Dodaj</a> <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#dlg').dialog('close')" style="width:80px">Zamknij</a> </div> </div>
<div id="tbin" style="padding:3px"> <div class="row"> <div class="col-lg-8"> <div class="form-group"> <div class="input-group"> <span class="input-group-addon add-on"><i data-time-icon="icon-time" data-date-icon="icon-calendar" class="fa fa-list-ol"></i> Numer wpisu</span> <input id="numberin" name="numberin" type="text" class="form-control" autocomplete="off" placeholder="Numer wpisu"> </div> </div> </div> <div class="col-lg-2"> <a href="#" class="btn btn-primary" plain="true" onclick="doSearch1()"><i class="fa fa-search"></i> Szukaj</a> </div> <div class="col-lg-2"> <a href="#" class="btn btn-primary" plain="true" onclick="newUser()"><i class="fa fa-plus"></i> Dodaj wpis</a> </div>
</div> </div> <div id="dd"><img style="text-align:center;" src="images/ajax-loader.gif"></div> <script type="text/javascript"> $(function(){
$('#dd').dialog({ title: 'Odpowiedź serwera', width: 400, height: 350, closed: false, cache: false, modal: false, }); $('#dd').dialog('close'); $("#dgin").css("width", $('.row').width()-70); $('#errorin').hide(); $('#dgin').datagrid({ pageSize: 50, pageList: [50,100,150,200], detailFormatter:function(index,row){ return '<div class="ddv" style="padding:5px 0"></div>'; }, columns:[[ {field:'Number',title:'Number',width:350,sortable:true}, {field:'date',title:'Data utworzenia',sortable:true}, {field:'rdate',title:'Data rozliczenia',sortable:true}, {field:'return',title:'Status',sortable:false,width:150,formatter:function(value,row){ if (value == 0){ return 'W doręczeniu'; } else if (value == 2){ return 'Zwrócono'; } else { return 'Dostarczono'; } }} ]], rowStyler:function(index,row){ if (row.return == 1){ return 'background-color:#00FF00;'; // return inline style } else if (row.return == 2){ return 'background-color:#FF0000;color:#fff'; // return inline style } }, onLoadSuccess:function(){ $(this).datagrid('getPanel').find('.deleter').each(function(){ $(this).linkbutton({ onClick:function(){ var id = $(this).attr('row-id'); // destroy the row if (id){ $.messager.confirm('Confirm','Are you sure you want to destroy this user?',function(r){ if (r){ // $.post('ajax/removelist.php',{entryid:id},function(result){ if (result.success){ $.messager.show({ // show errorin message title: 'Sukcess', timeout:10000, msg: result.LHN+'<br>'+result.List+'<br>'+result.Numb }); $('#dg').datagrid('reload'); // reload the user data } else { $.messager.show({ // show errorin message title: 'errorin', timeout:10000, msg: result }); } },'json'); } }); } } }) }) } }); }); function doSearch1(){ $('#errorin').hide(); $('#dgin').datagrid('load',{ number: $('#numberin').val() }); $('#numberin').val(''); } var url; function newUser(){ $('#dlg').dialog('open').dialog('setTitle','Nowy wpis'); $('#fm').form('clear'); url = 'add_entry.php?list=<?PHP echo $itemid; ?>'; } function saveEntry(){ $('#fm').form('submit',{ url: url, onSubmit: function(){ return $(this).form('validate'); }, success: function(result){ //var result = eval('('+result+')'); if (result){ $('#dd').html(result); $('#dd').dialog(); $.messager.show({ title: 'Odpowiedź serwera', msg: result }); $('#dlg').dialog('close'); $('#dgin').datagrid('reload'); } else { $('#dlg').dialog('close'); // close the dialog $('#dgin').datagrid('reload'); // reload the user data } } }); } function formatDetail(value,row){ //var href = 'landing.php?do=innerlist&list='+row.id+'&ln='+row.number; return '<center><a style="padding-right: 10px;" class="deleter" href="#" row-id="'+row.id+'"><span class="btn btn-info btn-xs"><i class="fa fa-trash-o">Usuń<span></a></center>'; } </script> my js/css loader <!-- Bootstrap Core CSS --> <link href="css/bootstrap.min.css" rel="stylesheet">
<!-- MetisMenu CSS --> <link href="css/plugins/metisMenu/metisMenu.min.css" rel="stylesheet">
<!-- Timeline CSS --> <link href="css/plugins/timeline.css" rel="stylesheet">
<!-- Custom CSS --> <link href="css/sb-admin-2.css" rel="stylesheet">
<!-- Morris Charts CSS --> <link href="css/plugins/morris.css" rel="stylesheet">
<!-- Custom Fonts --> <link href="font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<script src="http://code.jquery.com/jquery-latest.js"></script> <script src="http://code.jquery.com/ui/1.11.0/jquery-ui.min.js"></script> <script type="text/javascript" src="js/jquery.easyui.min.js"></script> <script src="js/plugins/morris/morris.js"></script> <script src="js/plugins/morris/raphael.min.js"></script> <script type="text/javascript" src="js/datagrid-detailview.js"></script> <script src="js/bootstrap.min.js"></script> <script src="js/bootstrap-select.min.js"></script> <script src="js/typehead.js"></script>
<script src="js/jquery.bootstrap.wizard.js"></script> <script src="js/jquery.datetimepicker.js"></script> <link href="css/jquery.datetimepicker.css" rel="stylesheet" type="text/css"> <link href="http://code.jquery.com/ui/1.11.0/themes/ui-darkness/jquery-ui.css" rel="stylesheet" type="text/css"> <link href="themes/default/easyui.css" rel="stylesheet" type="text/css">
<link href="http://www.jeasyui.com/easyui/themes/icon.css" rel="stylesheet" type="text/css"> <script src="js/jquery.window.js"></script> Error Uncaught TypeError: Cannot read property 'options' of undefined jquery.easyui.min.js:2728 _200 jquery.easyui.min.js:2728 (anonymous function) jquery.easyui.min.js:2967 jQuery.extend.each jquery-latest.js:383 jQuery.fn.jQuery.each jquery-latest.js:136 $.fn.panel.methods.open jquery.easyui.min.js:2966 $.fn.panel jquery.easyui.min.js:2926 $.fn.window jquery.window.js:323 $.fn.dialog jquery.easyui.min.js:3424 newUser VM5963:88 onclick landing.php?do=overview:1
|
|
|
14
|
General Category / EasyUI for jQuery / Node tree php
|
on: September 30, 2014, 12:22:00 PM
|
I use to get my names example output [{"id": 1,"name": "Marcin","surname": "A"}, {"id": 2,"name": "Piotr","surname": "B"}, {"id": 3,"name": "Kamil","surname": "C"}] and the customers could have a child [ but doesn't have to ] My query select listy.number,listy.id,listy.created,listy.type from listy where forwho = $id example ouput [{"number": "122232222222222222222222","id": 1,"created": "2014-09-12 14:51:00","type": 1}, {"number": "412333333333333333333333","id": 2,"created": "2014-09-03 15:15:00","type": 1}, {"number": "423233333333333333333333","id": 3,"created": "2014-09-03 16:08:00","type": 1}] What Iam willing to get is, [root] - [Marcin A] = 122232222222222222222222 = 412333333333333333333333 = 423233333333333333333333 - [Piotr B] = No entries [/root] I was basing on the example on : http://www.jeasyui.com/tutorial/tree/tree2.php but I can not achieve this somehow. All I need is to load data onclick on the [Name] cause the child can have ~100 entries My php code$result = array(); $rs = mysql_query("SELECT name, surname,id FROM customers"); while($row = mysql_fetch_array($rs)){ $node = array(); $node['id'] = $row['id']; $node['text'] = $row['name'].' '.$row['surname']; $node['state'] = has_child($row['id']) ? 'closed' : 'open'; array_push($result,$node); }
echo json_encode($result);
function has_child($id){
$rs = mysql_query("select listy.number,listy.id,listy.created,listy.type from listy where forwho = $id"); $row = mysql_fetch_array($rs); return $row[0] > 0 ? true : false; } generated : [{"id":"1","text":"Marcin B","state":"open"}......... It doesn't displays in the tree even, I use <ul id="tt" class="easyui-tree" url="tree.php"> </ul> and everything is properly directed and included for sure cause on a static .json file from other examples it shows up. It might be wrong with my code maybe. Thanks for help
|
|
|
15
|
General Category / EasyUI for jQuery / Re: onExpandRow action onClose?
|
on: September 30, 2014, 10:03:09 AM
|
It only loades a simple data into the div. Onclose I want it to clear the data [http://oi59.tinypic.com/dnj6z9.jpg] code : Container
<div class="easyui-tabs" id="accord" data-options="tabWidth:112" style="height:500px;"> <div title="Szczegóły" style="padding:10px"> <div id="jloading"></div> </div> <div title="Wpisy" style="padding:10px"> <div id="jinner"></div> </div> </div>
and my event for onExpand onExpandRow: function(index,row){ $('#jloading').html('<img src="themes/default/images/loading.gif">'); var ddv = $(this).datagrid('getRowDetail',index).find('div.ddv'); ddv.panel({ height:1, border:true, cache:false, href:'listdetail.php?listnumb='+row.number, onLoad:function(){ $('#dg').datagrid('fixDetailRowHeight',index); } }); $('#dg').datagrid('fixDetailRowHeight',index); $.ajax({ type: "GET", url: 'listdetail.php?listnumb='+row.number, success: function (d) { // replace div's content with returned data $('#jloading').html(d); } }); $.ajax({ type: "GET", url: 'listdetailsub.php?listnumb='+row.number, success: function (d) { // replace div's content with returned data $('#jinner').html(d); } }); },
Hope its enough information to help me out. Whenever I expand I want be able to close it and remove the content ( seems like onCollapseRow: $('#jinner').val(''), doesnt work here )
|
|
|
|