ajaxboy / cjax

Lightweight Ajax Framework built in PHP with no foot-print. Allows you to build ajax functionality with a single line of code & do so much more, right from the back-end!
http://cjax.sourceforge.net/
66 stars 27 forks source link

Update TableRow/TableCell doesn't work #9

Open MostTimeLurker opened 11 years ago

MostTimeLurker commented 11 years ago

it's impossible to update a TR or TD, since they have no "value"-Property, only "innerHTML".

To fix that, in function "this.property" (file ax/core/js/cjax.js), just put something like

                            case 'TR':
                                    element.innerHTML = value;
                                    break;
                            case 'TD':
                                    element.innerHTML = value;
                                    break;
                            default:
                                    console.log("element.value = " + element.value);
                                    element.value = value;

(the default is already in the file, around line 400)

ajaxboy commented 11 years ago

It is actually not impossible. You can also do:

$ajax->tr_id = array('innerHTML' => 'Your HTML');

and

$ajax->td_id = array('innerHTML' => 'Your HTML');

As documented in http://cjax.sourceforge.net/examples/js_properties.php

Though your question is focused around the "main property" feature (http://cjax.sourceforge.net/examples/main_property.php), and yes you are right, for the main property to operate properly for these HTML tags it should be as you suggest. I must of missed it, I'll change it to reflex the changes.

Thank you!,

MostTimeLurker commented 11 years ago

But this replaces " " (whitespace) with "+" (plus), so my content is borked up... any idea/solution about this?

EDIT: $this->ajax->my_dt = array('innerHTML', '1'); makes "<a+href="">1"

$this->ajax->my_dt = '1'; makes "1";

but, either... the click-event won't triggered anymore :(

ajaxboy commented 11 years ago

It replaces the innerHTML. What is the click event attached to?. If it is within the innerHTML then yes it will replace whatever you have in there. The whitespaces + are only for encoding purposes so that there wont be any errors, it is reverted once it is processed.