Hi Everyone, I found flexigrid yesterday myself and am also amazed at its functionality. I am very good at C and php, but learning quite well in js/jQuery land. THANKS to all of you for the incredible code snippets above. I believe my js knowledge has doubled reading these pages! As others have said, this is going to be my default tool for table display!
I need some help. Say when someone clicks next page, is there any way i can append onto the tbody, the next pages rows? So basically instead of going to the next page, itll just append the next pages rows to the tbody?
Paul
@mrpaul: I noticed behaviour like this when the rp: option is initialized to a value larger than choices in the rpOptions: [10,15,20,25,40] array.
I do not know enough about how these things interact to provide code, but you could / should be able to use an API call to extend rp with each call. You would keep the initial/default rp value in javascript and then pass to flexigrid as n*rp
??? Hope this helps.
Hello,
Don’t know if this question was already answered but is it possible to maintain item selection even if you change page? You can see this in the http://www.magentocommerce.com/demo datagrid. You can select only visible records or all records and if you change page it always maintains the selection.Thanks
@Armorfist: This is something of a hack, however I find it effective for one of my edit-in-place tables (implemented solely as form elements in TDs, written by the php)
Anyhow, I use javascript to add hidden elements to the HTML of the form I use:
var loc_text=" You've selected this location: "+loc_brand[idx[0]]+' > '+loc_page[idx[1]]+' > '+loc_group[idx[2]];
var pButton='<input type="button" class="right" id="changeButton">';
temp='<input type="hidden" name="action" value="doThisToItems" ><input type="name" name="loc" value="'+loc+'" >
'+temp+loc_text+'
'+pButton;
$('#container').empty().append(temp).fadeIn();
#container is the DIV around my form (external to flexigrid). loc is a string representing the coordinates of a location: 1,8,235 which are the IDs of each layer of my data where we are currently sitting. loc_text is the text label I present to the user to confirm their location choice. the loc_XXXX arrays are in the javascript, built dynamically on page load, have the human names for each of the location IDs. All of this is done independent of flexigrid, and I’m implementing checkboxes to add the row to the location or just delete the row.
As this is a sequential process, if you subsequently reverse one of your entries, the most latest addition is what is passed on POST.
Example:
<input type="hidden" value="modify" name="action"/>
<input type="hidden" value="523X" name="pn-3"/>
<input type="hidden" value="3" name="mfg_id-7"/>
<input type="hidden" value="224B" name="pn-9"/>
<input type="hidden" value="0" name="mfg_id-7"/>
I loop through $_POST and do:
list($tableLookup, $id) = explode("-", $_POST['name'] )
the ‘action’ => ‘modify’ pair tells that script what to do. I then have a lookup hash to get the table name from the “name”. Then it sets the VALUE to what is passed in. Ultimately, there is only one item with name=“mfg_id-7” and it’s value will be 0.
😊 Chris
(another post follows…)