Main Navigation

\Aksara\Laboratory\Core->columnSize()

The documentation and cheat sheet of our framework

columnSize() sets table column width classes.

Purpose

columnSize() sets table column width classes. It lets a controller customize Aksara Core behavior while keeping the request inside the built-in CRUD, rendering, permission, validation, and response pipeline.

When to Use

Use it when the generated table, form, or read view is mostly correct but one or more fields need custom behavior.

Reference

columnSize(string|array $params = [], ?string $value = null)

Parameters

ParameterTypeRequiredDefaultDescription
$paramsstring|arrayNo[]String value or associative array of values, depending on the method.
$value?stringNonullValue assigned to the given key or field.

Return Value

static

Returns the current controller instance so it can be chained with other Core methods.

Behavior

columnSize() updates field metadata used by the renderer. The generated output changes when the table, read, or form view is rendered.

Basic Usage

$this->columnSize('title', 'col-md-4');

return $this->render('orders');

Advanced Usage

$this->setAlias(['created_at' => phrase('Created'), 'updated_at' => phrase('Updated')])
    ->setValidation(['title' => 'required|max_length[160]', 'status' => 'required'])
    ->fieldOrder('title, slug, status, created_at');

Complete Example

namespace Modules\Orders\Controllers;

use Aksara\Laboratory\Core;

class Orders extends Core
{
    public function index()
    {
        $this->setTitle(phrase('Orders'))
            ->columnSize('title', 'col-md-4');

        return $this->render('orders');
    }
}

Result

The generated table, form, or read view uses the configured field behavior when the response is prepared.

Notes

  • This method is chainable and returns the current controller instance.
  • Field names must match table columns, selected aliases, relation aliases, or mock fields.
  • Most field configuration methods accept a single field/value pair or an associative array for bulk configuration.

Common Mistakes

  • Using a field name that is not present in the selected data.
  • Expecting the method to output HTML immediately instead of configuring the renderer.

Related Methods

Available Methods

addButton addClass addDropdown addField addFilter addSubmitButton addToolbar afterDelete afterInsert afterUpdate allowPublicFormSubmission allowTokenFrom beforeDelete beforeInsert beforeUpdate columnOrder columnSize databaseConfig debug defaultValue deleteBatch deleteData distinct fieldAppend fieldOrder fieldPosition fieldPrepend fieldSize formCallback from fromSubquery getMethod gridView groupBy groupEnd groupField groupStart having havingGroupEnd havingGroupStart havingIn havingLike havingNotIn ignoreQueryString insertData insertId itemReference join like limit mergeContent mergeField modalSize notGroupStart notHavingGroupStart notHavingLike notLike offset orGroupStart orHaving orHavingGroupStart orHavingIn orHavingLike orHavingNotIn orLike orNotGroupStart orNotHavingGroupStart orNotHavingLike orNotLike orWhere orWhereIn orWhereNotIn orderBy parentModule permitUpsert render renderForm renderRead renderTable restrictOnDemo searchable select selectAvg selectCount selectMax selectMin selectSubquery selectSum serialize serializeRow setAiContext setAlias setAttribute setAutocomplete setBreadcrumb setButton setDefault setDescription setField setHeading setIcon setMessages setMethod setOptionLabel setOutput setPermission setPlaceholder setPrimary setRelation setTemplate setTheme setTitle setTooltip setUploadPath setValidation sortable table unsetColumn unsetDelete unsetField unsetMethod unsetRead unsetSelect unsetToolbar unsetTruncate unsetUpdate unsetView updateData validToken validateForm verticalSchema viewOrder where whereIn whereNotIn