Hello everyone,
I have a form that displays data in a table.
done with crhonoconnectivity v5.
in this table I have two fields that I want to filter with two dropdownlist.
how is that possible?
I found how to search by entering text but not with dropdownlist.
you can tell me some guidance or suggestions?
thank you so much
I have a form that displays data in a table.
done with crhonoconnectivity v5.
in this table I have two fields that I want to filter with two dropdownlist.
how is that possible?
I found how to search by entering text but not with dropdownlist.
you can tell me some guidance or suggestions?
thank you so much
Hi rluongo,
I think Bob or Max already expalined that somewhere in the forum...
Just in case: use a chronoform code like this one:
I think Bob or Max already expalined that somewhere in the forum...
Just in case: use a chronoform code like this one:
<?php
$keys = \GCore\Libs\Arr::getVal(\GCore\Libs\Arr::getVal($rows, explode(".", "[n].YOURMODEL")), explode(".", "[n].YourFieldName"));
$values = \GCore\Libs\Arr::getVal(\GCore\Libs\Arr::getVal($rows, explode(".", "[n].YOURMODEL")), explode(".", "[n].YourFieldName"));
$options = array_combine($keys, $values);
$field = array
(
'name' => 'fltr[YOURMODEL][YourFieldName]',
'id' => '',
'options' =>
array (
),
'empty' => ' Search Name',
'values' =>
array (
),
'label' =>
array (
'text' => '',
'position' => 'left',
),
'sublabel' => '',
'multiple' => '0',
'size' => '',
'class' => '',
'title' => '',
'style' => '',
'params' => '',
':data-load-state' => '',
':data-tooltip' => '',
'type' => 'dropdown',
'container_id' => '0',
);
$field["options"] = $options;
echo \GCore\Helpers\Html::formLine($field["name"], $field);
echo '<div class="form-group gcore-form-row" id="form-row-1"></div>';
?>
Thank you so much Simelas,
I am a beginner, but I think I understand the operation of the script that you wrote kindly.
can you please describe it and tell me where to add?
Thanks again.
I am a beginner, but I think I understand the operation of the script that you wrote kindly.
can you please describe it and tell me where to add?
Thanks again.
Hi rluongo,
The script should be added to the header section of the listing.
Best regards,
Max
The script should be added to the header section of the listing.
Best regards,
Max
Thanks Max,
Unfortunately, being a beginner I did not understand how to fill it .... I would need some explanation to understand the functioning of the script so that you can fill out correctly.
could someone, politely, illustrate it?
thanks a lot to everyone
Unfortunately, being a beginner I did not understand how to fill it .... I would need some explanation to understand the functioning of the script so that you can fill out correctly.
could someone, politely, illustrate it?
thanks a lot to everyone
Hi rluongo,
It is quite simple to do it:
in settings >>> Columns list you put a field like YOURMODEL.YourFieldName: Title
in List display >>> Table >>> Header code you add the script as provided and it should be ok
Best,
simelas
It is quite simple to do it:
in settings >>> Columns list you put a field like YOURMODEL.YourFieldName: Title
in List display >>> Table >>> Header code you add the script as provided and it should be ok
Best,
simelas
Hello everyone and thanks for the answers,
I did some tests but I sript works in part and I can not figure out where I'm wrong, I try to explain what I'd need:
I have three related tables in a connection, questions table, table category, subcategory table.
questions table: idquestion, question, answer 1, answer 2, answer 3, CategoryID, idsubcategory.
Table category: CategoryID, description category.
Table subcategory: idsubcategory, description subcategory.
the page (made with chronoconnectivity) where I display the table "question", I would like to filter records by two dropdownlist connected by category and subcategory.
thanks a lot for taking the time and excuse translation errors
I did some tests but I sript works in part and I can not figure out where I'm wrong, I try to explain what I'd need:
I have three related tables in a connection, questions table, table category, subcategory table.
questions table: idquestion, question, answer 1, answer 2, answer 3, CategoryID, idsubcategory.
Table category: CategoryID, description category.
Table subcategory: idsubcategory, description subcategory.
the page (made with chronoconnectivity) where I display the table "question", I would like to filter records by two dropdownlist connected by category and subcategory.
thanks a lot for taking the time and excuse translation errors
Hi rluongo,
can you please explain what you mean by "script works in part " . do you get the drop down list ? or not , does it filter or not? etc ....
best rgds
s
can you please explain what you mean by "script works in part " . do you get the drop down list ? or not , does it filter or not? etc ....
best rgds
s
hello and thank you for your patience ...
I get the drop down list for a field but selecting an item in the table is not filtered. (for my project I have to filter through two drop-down lists on two fields "category and sub-category")
thank you so much
I get the drop down list for a field but selecting an item in the table is not filtered. (for my project I have to filter through two drop-down lists on two fields "category and sub-category")
thank you so much
Hi rluongo,
did you put the field [YOURMODEL][YourFieldName] to filter in Setting >>> Filters ?
best
s
did you put the field [YOURMODEL][YourFieldName] to filter in Setting >>> Filters ?
best
s
Hi,
Another route would be to use Connectivity v6, add a fields view inside a form view and place that above the table, the "read data" function conditions will need to include the dropdowns names to do the filtering.
Best regards,
Max
Another route would be to use Connectivity v6, add a fields view inside a form view and place that above the table, the "read data" function conditions will need to include the dropdowns names to do the filtering.
Best regards,
Max
Great Post. Definitely with this one I got the dropdown filter running. I only would ad for those with so little experience like me, to not forget to add to the code a submit button, i.e.:
And in the filter box it should look like:
YOURMODEL.YourFieldName
Thank you all for the help.
<input type="submit" name="submit" value="Filter" />
And in the filter box it should look like:
YOURMODEL.YourFieldName
Thank you all for the help.
This topic is locked and no more replies can be posted.