Jump to content


dbarros's Content

There have been 4 items by dbarros (Search limited from 18-August 18)


By content type

See this member's

Sort by                Order  

#149152 MultiSelect_Searchable not updating or inserting value

Posted by dbarros on 28 May 2019 - 01:26 PM in Grocery CRUD Enterprise

Hello @dbarros and @flawless,

 

I've created a ticket for that so I can investigate more on it. You can find the ticket here: https://trello.com/c...inserting-value

 and you can follow the progress of it by pressing the button "follow":

attachicon.gifScreenshot 2019-05-24 at 08.09.20.png

 

I will inform this forums post once this is done and released on the next version.

 

Till the bug is fixed can you please use: "multiselect_native" as a work-around?

 

Regards

Johnny

Thanks @web-johnny for the follow up.




#149085 MultiSelect_Searchable not updating or inserting value

Posted by dbarros on 02 April 2019 - 04:47 PM in Grocery CRUD Enterprise

It also seems like the search is not working, please see attachments. 

Attached Thumbnails

  • Screen Shot 2019-04-02 at 12.44.27 PM.png
  • Screen Shot 2019-04-02 at 12.44.14 PM.png



#149084 MultiSelect_Searchable not updating or inserting value

Posted by dbarros on 02 April 2019 - 04:42 PM in Grocery CRUD Enterprise

PHP version: PHP 7.3.3 (cli) (built: Mar  8 2019 16:40:07) ( NTS )

Laravel: 5.8

GCE: 2.3.7

 

Screen Shot 2019-04-02 at 12.28.40 PM.png

 

 

js error while selecting value from dropdown 

grocery-crud-v2.7.3.55d7110.js:2249 Uncaught TypeError: Cannot convert undefined or null to object
    at Function.from (<anonymous>)
    at _toConsumableArray (grocery-crud-v2.7.3.55d7110.js:2249)
    at InputMultiselectSearchable.linkedChange (grocery-crud-v2.7.3.55d7110.js:2290)
    at HTMLSelectElement.onChosenChange (grocery-crud-v2.7.3.55d7110.js:14782)
    at HTMLSelectElement.dispatch (jquery.js:5206)
    at HTMLSelectElement.elemData.handle (jquery.js:5014)
    at Object.trigger (jquery.js:8201)
    at HTMLSelectElement.<anonymous> (jquery.js:8269)
    at Function.each (jquery.js:362)
    at jQuery.fn.init.each (jquery.js:157)
_toConsumableArray @ grocery-crud-v2.7.3.55d7110.js:2249
linkedChange @ grocery-crud-v2.7.3.55d7110.js:2290
onChosenChange @ grocery-crud-v2.7.3.55d7110.js:14782
dispatch @ jquery.js:5206
elemData.handle @ jquery.js:5014
trigger @ jquery.js:8201
(anonymous) @ jquery.js:8269
each @ jquery.js:362
each @ jquery.js:157
trigger @ jquery.js:8268
Chosen.result_select @ grocery-crud-v2.7.3.55d7110.js:11549
Chosen.search_results_mouseup @ grocery-crud-v2.7.3.55d7110.js:11441
(anonymous) @ grocery-crud-v2.7.3.55d7110.js:11154
dispatch @ jquery.js:5206
elemData.handle @ jquery.js:5014

create Crud column  

  $isoDocs->fieldType(
                'isoRelatedID',
                'multiselect_searchable',
                Isodocs::getDocsList()
            );

data sample

Collection {#399 ▼
  #items: array:20 [▼
    1 => "WI-714-001"
    2 => "WI-850-001"
    3 => "WI-850-002"
    4 => "WI-850-003"
    5 => "WI-850-004"
    6 => "WI-850-005"
    7 => "WI-850-006"
    8 => "WI-715-001"
    9 => "WI-714-002"
    10 => "WI-850-007"
    11 => "WI-850-008"
    13 => "WI-850-009"
    14 => "WI-714-003"
    15 => "WI-850-010"
    16 => "WI-850-011"
    17 => "WI-850-012"
    18 => "WI-850-013"
    19 => "WI-850-014"
    20 => "WI-830-001"
    22 => "WI-850-015"
  ]
}

any help is appreciated, I tried using the document_name instead of the id however still getting same error. 

 

FYI  it's working as expected  with multiselect_native 




#16327 Change default Join Type setRelation()

Posted by dbarros on 13 June 2018 - 02:24 PM in Grocery CRUD Enterprise

 

I think then I will update the documentation for custom model to also include custom models with search: https://www.groceryc...te-custom-model :) . I will let you know once this is done.

 

Till then I will try to explain you some complicated parts of the setRelation (and that's why I can't get you a straight answer).

 

Grocery CRUD Enterprise has as a first priority (with comparison from community edition) two things:
1. Performance

2. Security

So in order to have a much better performance for setRelation we are NOT using any JOIN if that is not necessary (wait what?). Yes! That's true :) I will explain you what I mean with a real example: 

Let's say that we have 1,000,000 rows in our datagrid and we have a simple relation like this:
 

$crud->setRelation('country', 'countries', 'name');

Then the query in our to get the first 10 rows from the database is the below:
 

SELECT `customers`.`customer_name` AS `customer_name`, `customers`.`country` AS `country` FROM `customers` ORDER BY `country` ASC LIMIT 10 OFFSET 0

Query execution time: 0.0020740032196s (for 1M rows with relation!!)

 

Now as you can see there is no JOIN anywhere and the country ids are getting filled with JavaScript as we already know their values :)

Now on the other hand if we do the same query in community edition you will take something like this (I am not coyping the real one as the community doesn't have a profiler that I can export the queries):

SELECT `customers`.`customer_id` AS `customer_id`, `customers`.`customer_name` AS `customer_name`, `customers`.`country` AS `country` 
    FROM `customers` 
LEFT JOIN `countries` ON `customers`.`country` = `countries`.`iso` LIMIT 10 OFFSET 0

Query execution time: 102.174100876s  (without indexing of country) (50,000X slower in comparison with grocery CRUD Enterprise)

And if I change the indexing to be correct in the database the same query will take:

Query execution time: 78.6532018185s (with indexing on country field)

 

So the difference here is huge that's the main reason that I am trying to not use any JOIN if it is not necessary. I hope this gave you a bit more guidance about what you would like to do and the approach that you would like to follow.  If you would like to investigate to the queries you can add a custom model that extends the Model and see the queries that they are actually being made:

Step1. Create a custom model that will look like this:

 

<?php

use GroceryCrud\Core\Model;

class CustomModel extends Model {

}

Step2. Enable profiler with  a code like this:

 

$model = new CustomModel($database);

$model->setDefaultProfiler();

$crud = new GroceryCrud($config);
$crud->setModel($model);

...

Thanks Johnny  @web-johnny for the explanation. I will use your recommendations.