CodeIgniter Forums
Flexigrid - Lightweight but rich data grid - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Flexigrid - Lightweight but rich data grid (/showthread.php?tid=7179)



Flexigrid - Lightweight but rich data grid - El Forum - 03-20-2009

[eluser]Unknown[/eluser]
Hey all I am New to flexigrid but so Far Loving it. however I am using the json data type and the only thing I cant seem to figure out is if I have an object selected in the grid how do I get the value of the selected column / row. below is my code and my json.
Code:
$("#flex2").flexigrid
                        (
                        {
                        url: '/utils/Renderxml/permsearch?
id=200&format=JSON&param=roles&searchparam;=',
                        dataType: 'json',
                        colModel : [
                                {display: 'ID', name : 'id', width:
40},
                                {display: 'User / Role ID', name :
'username', width: 80, sortable : false, align: 'left'}
                                ],
/*                      searchitems : [
                                {display: 'Username', name :
'username'},
{display: 'Assigned', name : 'assigned', isdefault: false}
                                ],
                        sortname: "username",
                        sortorder: "asc",*/
                        //usepager: false,
                        title: 'Results',
                        //useRp: false,
                        //rp: 15,
                        //showTableToggleBtn: false,
                        width: 'auto',
                        height: 'auto'
                        //colResize: false
                        }
                        );
Code:
$("#rolesearch").click(function(){
var visibleState = true;
$("#rolesearchdialog").css("visibility",(visibleState ? "visible" :
"hidden"));
$("#flex2").flexOptions({url:  '/utils/Renderxml/permsearch?
id=200&format=JSON&param=roles&searchparam;=' + document.getElementById
('role').value});
$("#flex2").flexReload();
$("#rolesearchdialog").dialog('open');

});
here is my json
----------------------------------------------------------------
Code:
{
page: 1,
total: 1,
rows: [
{id:'1007',cell:['1007','testrole']}]

}



Flexigrid - Lightweight but rich data grid - El Forum - 03-22-2009

[eluser]ironlung[/eluser]
Hi there

I want to find a grid that can solve the following problem for me. Say I have a retailer and that retailer can sell product_types I would like to display 2 grids. The first displays all product_types the retailer sells and the second with all the product_types )(excluding the ones he is already selling for).

Then I would like to have 4 buttons <<, <, >, >> so I can move product_types between the controls. Would this be possible/ easy to do with this grid, I have several insteances where I want to implement this dual grid control.

If not can someone point me in the right direction please.

Kind regards


Flexigrid - Lightweight but rich data grid - El Forum - 03-26-2009

[eluser]meetsang[/eluser]
Hey guys,

I was trying the new flexigrid and it worked great. I am happy to use the tool. Tried first with my table, it didn't work. Then I just uploaded the code and it did work great. I think its a great utility. But, the delete button was unable to delete the first row. I went into the ajax.php code for function deletec and corrected the code as shown below:

foreach($countries_ids_post_array as $index => $country_id)
if (is_numeric($country_id) && $country_id >= 1)
$this->ajax_model->delete_country($country_id);

The "=" sign is missing in the code that prohibits deleting the first row.

Also, has anybody got simple instructions on implementing flexigrid? I believe it will be great if it has an automated code generation tool. I hope I will be successful on my next try.

Thanks.


Flexigrid - Lightweight but rich data grid - El Forum - 03-31-2009

[eluser]meetsang[/eluser]
I could implement flexigrid properly. There were some errors on my controller.

Thanks.


Flexigrid - Lightweight but rich data grid - El Forum - 04-10-2009

[eluser]Unknown[/eluser]
Hi,

how to add new data items to flexigrid.....

i have 2 text boxes and i want both the values inside the grid when i submit them or add them
here is my code.pls help

&lt;?
mysql_connect("localhost","root","");
mysql_select_db("lab")or die("CANNOT CONNECT To DATABASE".mysql_error());
?&gt;

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;Flexigrid&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" href="css/flexigrid.css" /&gt;
[removed][removed]
[removed][removed]


[removed]

function getXMLHTTP() { //fuction to return the xml http object
var xmlhttp=false;
try{
xmlhttp=new XMLHttpRequest();
}
catch(e) {
try{
xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1){
xmlhttp=false;
}
}
}

return xmlhttp;
}


$(document).ready(function(){

//$('#test_n').change(function() {

//$('#test_n').trigger('change');

//if($('#test_n optionConfusedelected').val()=="test")
//{

// var fname=$('#test_n').val();
//$('form').submit(function(){
//var fname=$('#test_n optionConfusedelected').val();
//jQuery("#flex1").flexReload();
//}

//else
//{
// var fname="";

// }

$("#flex1").flexigrid
(
{

/* $("form#submit").submit(function() {

// we want to store the values from the form input box, then send via ajax below
var fname = $('#fname').attr('value');
var lname = $('#lname').attr('value');

$.ajax({
type: "POST",
url: "ajax.php",
data: “fname=”+ fname + “& lname=” + lname,
success: function(del){
$('form#submit').hide();
$('div.success').fadeIn();
}
});
return false;
});
});*/
//type: "POST",
//url: 'add.php',
dataType: 'json',
colModel : [

{display: 'Test Name', name : 'test', width : 180, sortable : true, align: 'left'},
{display: 'Test Dept ID', name : 'test1', width : 70, sortable : true, align: 'center'}

],
buttons : [
{name: 'Add', bclass: 'add', onpress : test},
{name: 'Delete', bclass: 'delete', onpress : test},
{separator: true}
],

usepager: true,
title: 'TEST LIST',
useRp: true,
rp: 10,
showTableToggleBtn: true,
width: 700,
height: 255
}
);
//return false;
//}
//else
//{
$('form').submit(function(){

var fname=$('#test').val();
var fname1=$('#test1').val();
jQuery('#flex1').flexOptions({newp:1, params:[{name:'type', value: fname},{name:'sal',value:fname1}]});
jQuery("#flex1").flexReload();
return false;
//}
});
});

function sortAlpha(com)
{
jQuery('#flex1').flexOptions({newp:1, params:[{name:'letter_pressed', value: com}]});
jQuery("#flex1").flexReload();
}

function test(com,grid)
{
if (com=='Delete')
{
if($('.trSelected',grid).length>0){
if(confirm('Delete ' + $('.trSelected',grid).length + ' items?')){
var items = $('.trSelected',grid);
var itemlist ='';
for(i=0;i<items.length;i++){
itemlist+= items[i].test_id.substr(3)+",";
}
$.ajax({
type: "POST",
dataType: "json",
url: "delete.php",
data: "items="+itemlist,
success: function(data){
alert("Query: "+data.query+" - Total affected rows: "+data.total);
$("#flex1").flexReload();
}
});
}
} else {
return false;
}
}
else if (com=='Add')
{
alert('Add New Item Action');

}
}
[removed]
&lt;/head&gt;
<br /><br />

&lt;body align="center" bgcolor="#ffffff"&gt;
&lt;form method='post' action='&lt;? $_SERVER['PHP_SELF'] ?&gt;'&gt;

<div id="statediv">Test Name:&nbsp;&nbsp;&nbsp;
&lt;input type="text" name="test" id="test" /&gt;
&lt;input type="text" id="test1" name="test1"&gt;
&lt;input type="submit" value="submit" name="submit"&gt;&lt;/div>

<table id='flex1' style='display:none' ></table>
&lt;/form&gt;
<br /><br />

&lt;/body&gt;
&lt;/html&gt;


Flexigrid - Lightweight but rich data grid - El Forum - 04-29-2009

[eluser]lihanqin[/eluser]
Hello

I want to add one cell click event for flexigrid.How to do?

Thanks your help.


Flexigrid - Lightweight but rich data grid - El Forum - 04-29-2009

[eluser]Nicolas400[/eluser]
hi, I have some questions to allow more power to flexigrid.

I want to:
-add "actions" columns with no header, that let me Edit/Delete/or custom action.
-autoload FK values, almost table has a FK value, so I want to be able to load a "Descriptor" field.

less Important
-an example of an edit/add form, based on the grid, could be a popup .

May be some "charitable soul" could paste some code here !

Best Regards Smile
Nicolas


Flexigrid - Lightweight but rich data grid - El Forum - 06-12-2009

[eluser]Unknown[/eluser]
Hi Paolo,

I want to use the Flexgrid program but i would like to remove the dropdown menu to remove a field.
Is this possible?


Flexigrid - Lightweight but rich data grid - El Forum - 07-07-2009

[eluser]Myles Wakeham[/eluser]
I'm using Flexigrid with CI and it works great. Well almost...

I have a grid that I'm populating data using JSON, and the data range is determined by parameters passed in the traditional CI way (ie. http://www.domain.com/index.php/Controller/function/parm1/parm2/parm3...)

After spending hours trying to work out why the last parameter was never being correctly handled, I stumbled (via Firebug) as to what is going on. When the Flexigrid object loads, it calls back to my CI app via JSON to get its data. It gets its data and displays it perfectly. But then a 2nd callback is being sent from Flexigrid back to my CI app to get 'loading.html'

The problem with the 2nd GET request is the way its doing it. It looks like JS is taking the end of the current URI and removing the last values to the right of the final / character and replacing it with loading.html. This is wiping out my last parameter from the call which is where I discovered that the data range selected wasn't being correctly returned to my app (it was on the 1st GET request, but was then being wiped out with the 2nd).

I have no idea why its doing this, other than to possibly display a loading image or XHTML window or something like that. I'm also not sure if this is being driven by Flexigrid or by the CI implementation of it (I'm using some user contributed code for this, but I'm not exactly sure of its origin - I'll have to check). But on the off chance that this is standard behavior of Flexigrid, is there a way to turn off this loading.html GET request that is coming in? Has anyone else encountered this before?

Myles


Flexigrid - Lightweight but rich data grid - El Forum - 07-16-2009

[eluser]marinaccio[/eluser]
Checking it out right now, looks pretty cool!