That would be great ecarsted, I was thinking of making a function with jsonEncode myself.
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
March 28, 2008 10:13am
Subscribe [82]#106 / Apr 07, 2008 1:43pm
That would be great ecarsted, I was thinking of making a function with jsonEncode myself.
#107 / Apr 07, 2008 2:03pm
Armorfist,
for the ‘height:auto’ problem, height:auto is really not meant to be used for dynamic data because it bases its height on the loaded elements.
Is it possible to add one element if no results are found like “No Records” or something? That would (i think) fix the auto height issue and the grid wouldn’t be empty when no data is returned.
I want to use auto height because the browser window scroll is more fluid than the div scroll used in the grid.
Thanks
#108 / Apr 07, 2008 3:16pm
You can actually do this already in the setting like so
url: 'get_data_from_db.php', sortname: "name", sortorder: "asc", param: "numcode > 100" // more interesting when populated by php
Hi Paulo,
I am struggling with adding pramams.
I have tried
param:"where xxx",
wherestr:"where xxx",
param: {wherestr:"where xxx"},and nothing gets added to the post ;(
what am I missing.
TY in advance,
Eric
#109 / Apr 07, 2008 8:12pm
much better right?
Yes, this worked great! Thanks again.
Looking forward to 1.1.
#110 / Apr 07, 2008 9:24pm
Hi, Paulo
Looking at the code and stepping in with Firebug, (what a handy tool!),
I see that the correct thing to set is params, not param
if (p.params)
589 {
590 var nparam = {};
591 $.each(p.params, function() {
592 nparam[this.name] = this.value;
593 });
594 $.extend(param,nparam);
595 }
596so now, I am setting
params: {wherestr:"where xxx"},
Thing is though, nparam is not being updated. Hmm, not sure how to fix it.
Eric
ps. Also, not sure how I would change this value on the fly based on user input in a set of form fields.
#111 / Apr 08, 2008 12:19am
Hi, Paulo
Looking at the code and stepping in with Firebug, (what a handy tool!),
I see that the correct thing to set is params, not param
if (p.params) 589 { 590 var nparam = {}; 591 $.each(p.params, function() { 592 nparam[this.name] = this.value; 593 }); 594 $.extend(param,nparam); 595 } 596so now, I am setting
params: {wherestr:"where xxx"},
Thing is though, nparam is not being updated. Hmm, not sure how to fix it.
Eric
ps. Also, not sure how I would change this value on the fly based on user input in a set of form fields.
Hi Eric,
You are correct, the proper setting is indeed params. but to configure it you use this format
params: [{name:'name',value:'paulo'},{name:'lname',value:'marinas'}]I change it to this format, because using jQuery’s serializeMethod uses this same format as well.
for attaching the grid to a form, it is a bit more complicated, but here’s a rough idea.
Suppose you have a form like this:
<form id="formx"><input type="text" name="name" value="" /></form>you add a setting to flexigrid like this
onSubmit: onsubmitthen create a function like this
function onsubmit() {
var dt = $('#formx').serializeArray();
$("#flex1").flexOptions({params:dt});
return true;
}this will overwrite the initial value of p.params, so if you have initial value set in, then its probably better to add it to the form as well as hidden inputs.
note the return true in the function, because if you return false, the flexReload action will cancel, this is useful if you want to add a validation in your forms.
then also block the form’s submit event to call flexReload instead like this:
$("#formx").submit(function(){$('#flex1').flexReload();return false;});#112 / Apr 08, 2008 4:17am
Hi Paulo
I realized a problem in flexigrid.
If i have more columns and i want to show or hide columns and if the height of grid is a little bit small , the last columns don’t appear.
See the following link: http://contaflux.ro/gestiune/module/flexigrid.php
hi davgino,
I see your problem, right now I put every element that flexigrid generates under the .flexigrid class which hides overflow (this is a requirement), is the ability to resize the grid insufficient? I will tackle this usability problem in next release.
#113 / Apr 08, 2008 4:30am
How can I integrate a code where a downloadable link is listed in the table listed as entity(ies) (e.g. Printable_Name) is a link? How can I do that?...
#114 / Apr 08, 2008 4:38am
How can I integrate a code where a downloadable link is listed in the table like an enitities listed for (e.g. Printable_Name) is a link? How can I do that?...
2 ways:
1. You can send the data with a link already in it. This is easier if your not into Javascript. Just remember to handle the quotes and double quotes.
2. In the colModel
{display: 'Printable Name', name : 'printable_name', width : 120, sortable : true, align: 'left'},add a property called process
{display: 'Printable Name', name : 'printable_name', width : 120, sortable : true, align: 'left', process: makeLink},then create a function with the name makeLink
function makeLink(celDiv)
{
$(celDiv).html('<a href="http://thisisalinkfolder/">Link</a>');
}The assumption here is that what ever data you are passing to that column is what you need to create your link.
Hope this helps. 😊
#115 / Apr 08, 2008 5:14am
How can I integrate a code where a downloadable link is listed in the table like an enitities listed for (e.g. Printable_Name) is a link? How can I do that?...
2 ways:
1. You can send the data with a link already in it. This is easier if your not into Javascript. Just remember to handle the quotes and double quotes.
2. In the colModel
{display: 'Printable Name', name : 'printable_name', width : 120, sortable : true, align: 'left'},add a property called process
{display: 'Printable Name', name : 'printable_name', width : 120, sortable : true, align: 'left', process: makeLink},then create a function with the name makeLink
function makeLink(celDiv) { $(celDiv).html('<a href="http://thisisalinkfolder/">Link</a>'); }The assumption here is that what ever data you are passing to that column is what you need to create your link.
Hope this helps. 😊
This is great dude.. Thanks…
By the way? Are you a Filipino? hehehe… 😊
#116 / Apr 08, 2008 6:22am
Hey Paulo,
Sorry if I’m being annoying but can you take a look at my earlier post? :D
Thanks
#117 / Apr 08, 2008 7:25am
Heya Paulo,
Thanks for the help.
Been fighting with a ton of mistakes I had made, but I finally got it working.
I was getting weird behavior using the submit method (the page would reload before the
data was processed, so I just put a button that called the following function.
function onsearch() {
var dt = $("#search_params").serializeArray();
var pg = new Object;
pg.name ='page';
pg.value = 1;
dt.push(pg);
$("#emp_table").flexOptions({params:dt});
$("#emp_table").flexReload();
return true;
}I need to set the page back to 1 because the number of results returned will change.
I don’t set the onSubmit in the form.
Works like a champ. I have three field in the form, one text input, and 2 drop down lists, the submit button and a reset button.
Post looks like :
company 0
department 2
name ar
page 1
qtype
query
rp 15
sortname Last_Name
sortorder asc
On the server side I process the results by stinging together a where clause.
TY again. I think I can move on to other things now. lol.
Eric
#118 / Apr 08, 2008 8:52am
Hey Paulo,
Sorry if I’m being annoying but can you take a look at my earlier post? :D
Thanks
Hi Armorfist, try hacking the CSS like this
.bDiv
{
min-height: 200px;
}I have to say that i haven’t tested this personally, just off the top of my head. But it should work for all browsers, with the exception of IE6.
#119 / Apr 08, 2008 8:55am
Heya Paulo,
Thanks for the help.
Been fighting with a ton of mistakes I had made, but I finally got it working.
I was getting weird behavior using the submit method (the page would reload before the
data was processed, so I just put a button that called the following function.function onsearch() { var dt = $("#search_params").serializeArray(); var pg = new Object; pg.name ='page'; pg.value = 1; dt.push(pg); $("#emp_table").flexOptions({params:dt}); $("#emp_table").flexReload(); return true; }I need to set the page back to 1 because the number of results returned will change.
I don’t set the onSubmit in the form.Works like a champ. I have three field in the form, one text input, and 2 drop down lists, the submit button and a reset button.
Post looks like :
company 0
department 2
name ar
page 1
qtype
query
rp 15
sortname Last_Name
sortorder ascOn the server side I process the results by stinging together a where clause.
TY again. I think I can move on to other things now. lol.
Eric
Great Job Eric.
I would have use different technique, but as long as it works for you, and that the plugin is useful for you then I’m happy about it. 😊.
Paulo
#120 / Apr 08, 2008 1:51pm
Great Job Eric.
I would have use different technique, but as long as it works for you, and that the plugin is useful for you then I’m happy about it. 😊.
Paulo
I am sure you would! I just started learning Javascript on Saturday, still having trouble with the prototypal nature of the language and syntax. I will say I have learned a ton from reading your code and stepping through it with the debugger. Coffees on the way, to say TY.
Eric
ps. BAH!, still got a bug, clobbered my paging. Lack of sleep kills.
My mistake was to add page to params. What is the correct way to call
flexOptions with just one option to set, i.e. page:1 ?