Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82099

Determine count of items in an editor 'select' item

$
0
0

I'm showing a select list of items (MapCategory) that a Map item can belong too. I want to disable the Create button in the Map editor UI until the user has created at least one MapCategory item. How can I determine the count of MapCategory items on the client side.

A snippet of code from the Map editor looks as follows:

    Editor::inst($db, 'Map', '_id')
        ->fields(
            <snip><snip><snip>
            Field::inst('Map._idCategory')
                ->options(Options::inst()
                    ->table('MapCategory')
                    ->value('_id')
                    ->label('name')
                )
                ->validator(Validate::dbValues()),
            Field::inst('MapCategory.name'),
            <snip><snip><snip>
        )
        ->leftJoin('MapCategory', 'MapCategory._id', '=', 'Map._idCategory')
        ->process($_POST)
        ->json();

The MapCategory is shown using a 'Select' control on the client (JavaScript) side. I'd like to disable 'Create' button on Map table until at least one MapCategory has been created. How can I get the count of MapCategory items in the editor above?


Viewing all articles
Browse latest Browse all 82099

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>