'Show All' button not works properly (datatable) [SOLVED]

Post modules, themes or any other code you want to share with the community.

Moderator: Developers

mocsokmike
Posts: 58
Joined: Tue Jul 18, 2006 2:50 pm

'Show All' button not works properly (datatable) [SOLVED]

Postby mocsokmike » Tue May 13, 2008 9:16 am

Hi,

I am using the datatable class, and everything works properly until I give a value to 'offset'. If I do this, the 'Show All' button does not list all entries, just returns the first page of the list.

An example:

Code: Select all

...
$this->start,
$this->offset,
...
$this->set_pagination($this->count);

(Works properly - the value of 'offset' is taken from the system)

My problem:

Code: Select all

...
$this->start,
$this->offset=$settings['dl_num_lines'],
...
$this->set_pagination($this->count);

(Pagination works properly, I can navigate between the pages as I like, but the 'Show All' button returns the first page instead of everything. The only difference is that the value of 'offset' was given by me.).

In both cases the url of the 'Show All' button is the same:

Code: Select all

javascript:table_change_page('0','kyo_logs',0,0);


This looks OK, and works in the first example. I am a bit lost. I tried to look in datatable.class.inc, table.class.inc, but found no signs about the source of my problem. If anyone knows, please reply.

And one more detail: I am using GO Community 2.16
Last edited by mocsokmike on Thu May 15, 2008 4:58 pm, edited 1 time in total.
mschering
Site Admin
Site Admin
Posts: 8154
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Postby mschering » Wed May 14, 2008 7:27 am

Show all should set the offset to 0. You are setting it manually so that's why it doesn't work. You don't need to set it manually.
Best regards,

Merijn Schering
Intermesh
mocsokmike
Posts: 58
Joined: Tue Jul 18, 2006 2:50 pm

Postby mocsokmike » Wed May 14, 2008 3:01 pm

Oh.
But I need to do this - I display two different datatables on two tabs of a tabstrip. One has normal (1-line) rows, the other uses 4 or 5 lines thick rows. I decided to create a settings section for this module in the 'Settings' menu where users can set their desired row numbers for both list types.

Is there no way to override this? This installation is already heavily modified, as it is for special usage, so I don't mind changing some system parts if needed.
mschering
Site Admin
Site Admin
Posts: 8154
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Postby mschering » Wed May 14, 2008 3:21 pm

You should try to pickup the show_all click and also manually set the offset to 0.
Best regards,



Merijn Schering

Intermesh
mocsokmike
Posts: 58
Joined: Tue Jul 18, 2006 2:50 pm

Postby mocsokmike » Wed May 14, 2008 5:43 pm

OK, thanks for the hint.

Can you help a little bit? I admit I'm not very good in php+javascript.
I was trying to add this if block to javascript/datatable.js, into function table_change_page:

Code: Select all

if(document.forms[form_id].elements[table_id+"[task]".value == "show_all"])
  {
    document.forms[form_id].elements[table_id+"[offset]"].value="0";
  }


With no success. I can't imagine a better way to do this - is something wrong with the above code?
mocsokmike
Posts: 58
Joined: Tue Jul 18, 2006 2:50 pm

Postby mocsokmike » Thu May 15, 2008 4:57 pm

I found an easier way to do it.
Didn't need to change the javascript - just inserted an 'if' block before the previously mentioned section in the class which creates the list.
The new 'if' block checks if the value of $this->offset is zero, and in case yes, it changes $settings['dl_num_lines'] to zero as well.

Should have come to my mind earlier... :oops:
jimm1909
Posts: 1
Joined: Wed Oct 20, 2010 3:57 pm

Re:

Postby jimm1909 » Wed Oct 20, 2010 3:58 pm

mocsokmike wrote:I found an easier way to do it. Vegas Shows Vegas Hotel Deal Best Cirque Du Soleil Vegas Show New Las Vegas Show
Didn't need to change the javascript - just inserted an 'if' block before the previously mentioned section in the class which creates the list.
The new 'if' block checks if the value of $this->offset is zero, and in case yes, it changes $settings['dl_num_lines'] to zero as well.

Should have come to my mind earlier... :oops:


Awesome that did the trick for me.

Thanks a lot,

-Jim

Return to “Contributed development”

Who is online

Users browsing this forum: No registered users and 1 guest

cron