Ajax DataGrid Support Product Page

custom_lib - custom function

Reported 14 Oct 2010 18:11:48
1
has this problem
14 Oct 2010 18:11:48 Pascal B posted:
Hi,

Using PHP / MySQL, Dreamweaver CS4 and Datagrid v1.0.6

I need to add some additional functions in the custom_lib file and am doing some testing first. Added the following to the custom_lib.php file:

<?php
function trimlength($thisvalue) {
$thisvalue = substr("$thisvalue", 0, 10);
return $thisvalue;
}
?>

Then manually typed trimlength in the 'format' field of the 'content' tab and clicked 'OK'. Unfortunately, the 'trimlength' value doesn't get saved and it doesn't work.

Am I doing something wrong or is it a problem with the script?

Hoping someone can help.

Thanks

Pascal
Edited by - Pascal B on 14 Oct 2010  18:12:16

Replies

Replied 19 Oct 2010 12:10:01
19 Oct 2010 12:10:01 Pascal B replied:
Hi,

I would like to ask for a refund for this script please. It doesn't seem to work fully and I cannot get any support on this forum.

Thanks.
Replied 19 Oct 2010 13:02:36
19 Oct 2010 13:02:36 Miroslav Zografski replied:
Hello Pascal,

I'm sorry for the delay in my answer.

The timelengh value you entered in the UI is not saved due to some limitations in DW environment.
The function you are trying to call in the format filed is correct.
Will double check the way you need to refer the content that needs to pass through your function.

Regards,


Replied 19 Oct 2010 18:37:15
19 Oct 2010 18:37:15 Pascal B replied:
Thanks Miroslav,

Looking forward to hear from you as I would much prefer to make it work instead of getting a refund.
Replied 21 Oct 2010 17:56:55
21 Oct 2010 17:56:55 Pascal B replied:
Any news on this? I am working on a project that requires a grid and cannot wait much longer before I have to look for another solution.
Replied 25 Oct 2010 10:21:05
25 Oct 2010 10:21:05 Miroslav Zografski replied:
Hello Pascal,

to get your custom function displayed in the UI open the corresponding dmx_grid#.php file ( you can see which one is it in the code of the datagrid ).
go to line 56, which currently must look like:

	array('strip_tags',   'HTML - Strip HTML'),


, copy that line and paste it on new line after the 56 one so it looks like :

	array('strip_tags',   'HTML - Strip HTML')
	array('strip_tags',   'HTML - Strip HTML')

Then add a comma at the end of line 56.

line 57 change so it corresponds to your custom function:

	array('strip_tags',   'HTML - Strip HTML'),
	array('trimLength',   'Trim to X chars length')


save the file and open the UI of the Datagrid. Go to Content tab and from the Format field choose "Trim to X chars length" for each field you want to be formated through your custom function.
Save and test the data grid containing page.

Regards,

Reply to this topic