Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by nicolas on Jan 19, 2010 07:04
open dhtmlx forum
connector_select_filter XML

Hello,

I don't configure my grid header from javascript.
I am using a custom php script to generate xml which is then used to build it.
"
$gridConn->set_options("study.StudyDate",array("Ce jour"=>1,"Cette semaine"=>2,"Ce mois"=>3));

$gridConn->event->attach("beforeOutput","grid_header");

    function grid_header(){
        if (!isset($_GET["posStart"]) && !isset($_GET["connector"]))
            echo '
            <head>               
                <!-- Patient.ID -->
                <column width="0" hidden="true" type="ro" align="center" sort="connector" name="IDPatient" id="IDPatient">IDPatient</column>
                ...
                <afterInit>
                    <call command="attachHeader">
                       <param>#rspan,#rspan,#rspan,#connector_text_filter,#connector_text_filter,#connector_select_filter,...</param>
                    </call>
                </afterInit>

    }
"

But select filter stay blank.
If I use "setHeader", "attachHeader" and other functions, my select box is filled.

One suggestion?
regards,
Answer posted by Alex (support) on Jan 19, 2010 08:02

Hello

the information about select filters, that need to be filled, is automatically sent with the loading request to the server. If grid is configured on server, this information is unknown. 

To solve the issue you should pass the index of the columns with select filters as follows:  

grid.load("some.php?dhx_colls=5");

If there are more select filters, indexes should be passed as list. For example grid.load("some.php?dhx_colls=5,7");

Answer posted by nicolas on Jan 19, 2010 08:32
Thanks, it's working now.

2 others points:

a: my select_filter boxs are not automatically filled. I need to use "set_options"
function. It is normal or i don't understand some thing?

b: the fonction "set_encoding" has no effect.
I'd need to add:
"
echo '<?xml version="1.0" encoding="'.$this->encoding.'"?>';
"
in file: base_connector.php
in fonction: output_as_xml
after: header("...");

What do you think about my correction?

regards,
Answer posted by Alex (support) on Jan 20, 2010 01:19
Both problems are confirmed. Please try to use use attached files instead of originals 
Attachments (1)
Answer posted by nicolas on Jan 20, 2010 01:51
Hello,

I tried your file but it doesn't work.
I remove select_filter and other stuffs not necessary, and i get empty window message.
In the "some.txt", i get only the banner:

==============================
log strated, 20/01/2010 10:01:35
==============================

I also removed my function "grid_header", i removed attached Header and it's the same.
sorry,
If you want more informations about my sources, tell me.
see you soon
Answer posted by Alex (support) on Jan 20, 2010 02:31
We have forgotten to attach one more file - connector.js. 
Attachments (1)
Answer posted by nicolas on Jan 20, 2010 02:37
not better!
I get the same problems like my last answer!
regards,
Answer posted by Alex (support) on Jan 20, 2010 04:03
Sorry... one more file has to be replaced. The archive with the files is attached.
Attachments (1)
codebase.zip13.45 Kb
Answer posted by nicolas on Jan 20, 2010 04:40
ok, i have no more my last error (empty window message).
But it's not better, i explain:

1- If i use api (setheader(), attachheader()) with or without function "set_options()" of GetConnector, my select_filter is empty.
2- If i use event "beforeOutput" to generate xml for my header without function "set_options()",i get the message in "some.txt":"
!!!Uncaught Exception
Code: 0
Message: Incorrect dataset minimization, master field not found.
"
3- If i use with function "set_options()" it ok. but it's not an automatic!

An other problem: (with new and last files)
if i use this code:
"
    $filterModa = new OptionsConnector($resultConnection);
    //if($debug) $filterModa->enable_log("some.txt");
    $filterModa->render_sql("SELECT DISTINCT study.Modality as modality FROM study","study.Modality","study.Modality(modality)","","");
    $gridConn->set_options("study.Modality",$filterModa);
"
my select_filter is filled with word "null". The number of "null" is correct.

tell me,
see you soon,
Thank you for your responsiveness.



Answer posted by nicolas on Jan 21, 2010 05:15
Ok,
I found an error in your last dd_common.php:
You use the function "$this->escape_name" to add "  '  " caracter
around column name.
But in my case, my columns names are ex: study.ID (table.column). It's not an ALIAS.
Mysql don't like (ex: ... WHERE 'study.ID' LIKE '90' ....)
This is the error message:
"
Message: MySQL operation failed
Unknown column 'study.ID' in 'where clause'
"
I changed 'escape_name($data)' function to return only $data.
I tried it for loading, sorting and searching data and it work fine.
I didn't try for 'update', 'delete' and 'insert'.

Are you working on my 2 last problems:
auto fill select_filter and 'new OptionsConnector(...)'?

regards,

Answer posted by nicolas on Jan 21, 2010 05:39
I'm sorry, if found my error about 'new OptionsConnector(...)'.
It's important that the alias is "value" for query:
$filterModa->render_sql("SELECT DISTINCT study.Modality as value FROM study","study.Modality","study.Modality(value)","","");

thanks again,
regards.
Answer posted by Alex (support) on Jan 21, 2010 06:14

Hello

are some of the problemss still actual ? If they are, please provide the full code of connector initialization. 

Answer posted by nicolas on Jan 21, 2010 07:26
Hello,

Every is ok for moment.
the only one left is filling 'select_filter'.
For the moment i use "new OptionsConnector(...)" to fill my select_filter.
Does my recent observations, about escape_name function "is correct?

best regards,
Answer posted by Alex (support) on Jan 22, 2010 07:45

Hello

>> For the moment i use "new OptionsConnector(...)" to fill my select_filter.

Automatic filter confirguration can fail if there are issues with method that renders grid. OptionsConnector is a good solution in this case. 

>> Does my recent observations, about escape_name function "is correct?

The issue with escape_name is confirmed.

db_common.php was fixed. 

Moreover we have found the issue in the connector.js that we sent you before. The correct file is attached.

Attachments (2)