|
Title: [SOLVED] how to show character space on easyui-datagrid Post by: sky_proj on April 25, 2016, 02:00:03 AM source table mysql : people
CODE | NAME A1 | AGUS => with 0 space A2 | A GUS => with 1 space A3 | A GUS => with 2 space A4 | A GUS A5 | A GUS A6 | A GUS file : getdata.php // total rec data $rs = mysql_query("select count(*) from people"); $result["total"] = mysql_result($rs,0); // get detail data $query="select * from people"; $rs = mysql_query($query) or die(mysql_error()); //get into format json $items = array(); while($row = mysql_fetch_object($rs)){ array_push($items, $row); } //total keseluruhan isi data $result["rows"] = $items; echo json_encode($result); data.php <table id="serie" title="Browse" class="easyui-datagrid" style="width:400px;height:250px" data-options="url:'getdata.php',fitColumns:true,singleSelect:true">> <thead> <tr> <th field="CODE" width="100">CODE</th> <th field="NAME" width="100">NAME</th> </tr> </thead> </table> result datagrid : CODE | NAME A1 | AGUS => with 1 space A2 | AGUS => with 1 space A3 | AGUS => with 1 space A4 | AGUS => with 1 space A5 | AGUS => with 1 space A6 | AGUS => with 1 space any one can help me i want show like source : A1 | AGUS => with 0 space A2 | A GUS => with 1 space A3 | A GUS => with 2 space A4 | A GUS => with 3 space A5 | A GUS => with 4 space A6 | A GUS => with 5 space Thanks Title: Re: how to show character space on easyui-datagrid Post by: Pierre on April 25, 2016, 03:27:39 AM Try to add this
Code: Title: Re: how to show character space on easyui-datagrid Post by: Max Lamda on April 25, 2016, 04:24:08 AM Just replace the spaces in the field "NAME" by a non-breaking space (= ) as mentioned above but also by any other character(s) for your choice.
while($row = mysql_fetch_object($rs)){ array_push($items, $row); } becomes while($row = mysql_fetch_object($rs)){ $row['NAME']=str_replace(' ', ' ', $row['name']); array_push($items, $row); } Title: Re: how to show character space on easyui-datagrid Post by: sky_proj on April 25, 2016, 05:46:47 PM Just replace the spaces in the field "NAME" by a non-breaking space (= ) as mentioned above but also by any other character(s) for your choice. while($row = mysql_fetch_object($rs)){ array_push($items, $row); } becomes while($row = mysql_fetch_object($rs)){ $row['NAME']=str_replace(' ', ' ', $row['name']); array_push($items, $row); } it's working.. thanks a lot |