EasyUI Forum
April 29, 2024, 02:48:19 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1] 2
1  General Category / EasyUI for React / Re: DataGrid filter reset? on: July 12, 2020, 02:55:11 PM
Yes!!!
Thanks.
This helped me perfectly!
2  General Category / EasyUI for React / Re: DataGrid filter reset? on: July 11, 2020, 03:42:34 PM
It seems to me that I have the same bug
My project was stoped, I am not found a solution
I have two dataGrid at different layers. First have filter. After apply filter, second dataGrid do not shows rows and data
I prepared test in my repository https://github.com/Shatki/dg-test
3  General Category / EasyUI for React / Re: Possibility to get a DataGrid filter rows on: February 06, 2020, 09:41:22 AM
what did you try?  I don't see any onFilterChange there.
Earlier I had shown only checked worked code

Event onFilterChange give us a filterRules what we changed. I don't understand how it will help us
Thanks
4  General Category / EasyUI for React / Re: Possibility to get a DataGrid filter rows on: February 05, 2020, 10:41:01 PM
closest I've found is to use the onFilterChange event
I tried it but to no avail

I did it like this:
Code:

constructor(props){
    super(props){
    ...
    }
    this.viewRows = [],
    this.viewRowsLength = 0
}

renderCode = ({ value, row, rowIndex }) =>{
        if (rowIndex < this.viewRowsLength) this.viewRows = this.viewRows.slice(0, rowIndex + 1);
        this.viewRows[rowIndex] = row;
        this.viewRowsLength = rowIndex;
        return value
    };

<DataGrid>
    ...
    <GridColumn
        render = { this.renderCode }
        field="code" title="Code" width="10%"/>
    ...
    ...
<DataGrid/>

But maybe possible to make it more simple?
5  General Category / EasyUI for React / Possibility to get a DataGrid filter rows on: February 04, 2020, 02:36:53 PM
Hello!
Is there a way to get all showed rows after applied a DataGrid filtering?
Like a sampled this:
https://www.jeasyui.com/demo-react/main/index.php?plugin=DataGrid&theme=metro-blue&dir=ltr&pitem=&sort=asc

Thanks!
6  General Category / EasyUI for React / Re: DataGrid render only first time on: January 26, 2020, 04:33:18 AM
I  apologize
As I thought, this defect is my mistake

Thank you for your wasted time
7  General Category / EasyUI for React / [SOLVED] DataGrid render only first time on: January 24, 2020, 01:43:58 PM
Hello!
EasyUI react didn't have the PropertyGrid component. Because I made it from DataGrid like a fragment code bellow.
My component gets a new data. State is change but render DataGrid with a new data does not happen. Render happened only one time when new data is taken.
"Data" is an array with always length 18. Each element is an object row like a:
Code:
{"nameField": "code", "valueField": null, "titleField": "Код", "groupField": "Основные",
                    "editorField": "text", "rules": ["required", "positive"] },

I don't understand why this is so
Please help me fix this trouble
Thanks

Code:
import React, { Component } from 'react'
import { ComboBox, DataGrid, GridColumn, SwitchButton, TextBox, Tooltip, ComboTree } from 'rc-easyui'
import ContextMenu from '../context-menu'
import ErrorBoundry from '../error-boundry'
import CodeEditor from "./item-code-editor";


export default class ItemDetail extends Component {
    constructor(props) {
        super(props);
        this.state = {
            data: [],                          
            processedTreeData: null,          
            parent: null,                      
            rules: null,
            errors: null,
            editing: false,                    
            selection: null,                  
            comboData: null,                    
            comboDlgClosed: true,
            comboDlgEditRow: null              
        };
        this.validateRules= {
            //const n = value ? String(value).trim().length : 0;
            //return value.length === parseInt(param[0], 10);
            "required": {
           ...
            },
            "nullable": {
            ...  
            },
            "digital": {
                "validator": (value) => {
                    console.log("digital validation", value);
                    return /^\d+$/.test(value);
                },
                message: 'Код может состоять только из цифр'
            },
            "float": {
                "validator": (value) => {
                    console.log("float validation", value);
                    return /^\d*\.?\d+$/.test(value);
                },
                message: 'Значение должно быть десятичным числом'
            },
            "positive": {
                "validator": (value) => {
                    console.log("positive validation", value);
                    //if(Array.isArray(value)) return true; // Todo доделать!!!
                    return parseInt(value, 10) > 0;
                },
                message: 'Значение не может быть отрицательным',
            },
          
           //...

        };
        this.cellErrorMessage = "Ошибка данных";
    }

    /* ----------------- Lifecycle methods -------------------------------------------- */
    componentDidMount() {
        this.updateData();
    }

    componentDidUpdate(prevProps, prevState) {
        if(prevProps.data !== this.props.data) {
            console.log("componentDidUpdate ItemDetail", this.state.data);      // works well
            this.updateData();}
    }
    /* ----------------- Data operations ---------------------------------------------- */
    updateData = () => {
        const { data, processedTreeData } = this.props;
        if(data){
            this.setState({
                data,                       // set a new data
                processedTreeData,   // for a tree
            })
        }
    };

   //...

   /* ----------------- Render методы отображения компонента ------------------------- */
    renderEditor = ({ row, error }) =>{
        //...
        }
    };

    renderView = ({ value, row }) => {
        console.log("render view=>", row.nameField, value);   // this works only first render
        if (row.editorField === "text")
            return(<div>{ row.valueField }</div>);
        else if(row.editorField === "number")
            return(<div>{ row.valueField }</div>);
        else if(row.editorField === "switch")
            return(<SwitchButton value={row.valueField}/>);
        else if(row.editorField === "tree"){
            const { processedTreeData } = this.state;
            const node = getNodeByUuid(processedTreeData, row.valueField);
            //console.log("Render View getNode=>", node, 'row.valuefield=>',row.valueField);
            if(node) return(<div>{ node.text }</div>);}
        else if(row.editorField === "combo"){
            const dataField = Array.isArray(row.dataField) ? row.dataField : this.props[row.dataField] || null;
            if(row.valueField===null && Array.isArray(dataField))
                return(<div>{ dataField[0].text }</div>);
            if(row.valueField !== null && Array.isArray(dataField)){
                const value = dataField.find(item => (item.value === row.valueField));
                if (value !== undefined) return(<div>{ value.text }</div>);
            }
        }
        // Ошибка
        return(<div className="error">{ this.cellErrorMessage }</div>);
    };

    renderGroup = ({ value, rows }) =>{
        return (
            <span style={{ fontWeight:'bold'}}>{value} - <span style={{ color:'red' }}>{ rows.length }</span> свойств(а)
      </span>
        )
    };

    renderContextMenu = () => {
        return(
            <ContextMenu
                menu = { this.props.contextMenu }
                menuRef = { (ref)=>this.menu=ref }
                handleItemClick = { this.handleContextMenuClick }
            />
        )
    };

    render() {
        const { data, rules, comboData, comboDlgClosed } = this.state;
        //console.log("render ItemDetail", data);
        return(
            <ErrorBoundry>
                <DataGrid
                    ref = { detail=>this.detail=detail }
                    data = { data }
                    //idField = "nameField"
                    columnResizing
                    dblclickToEdit
                    expanderWidth = { 20 }
                    selectionMode = "row"
                    editMode = "row"
                    groupField = "groupField"
                    renderGroup={ this.renderGroup }
                    onCellContextMenu={ this.handleItemContextMenu }
                    onRowClick = { this.handleItemDetailRowClick }
                    onRowDblClick = { this.handleItemDetailRowDblClick }
                    onEditEnd = { this.handleEndEdit }
                    //onEditValidate = { this.handleEditValidate }
                >
                    <GridColumn width={ 25 }/>
                    <GridColumn field="titleField" title="Имя поля" width="40%"/>
                    <GridColumn field="valueField" title="Параметр" width="60%"
                                editable
                                editRules={ rules }
                                editor={ this.renderEditor }
                                render={ this.renderView }
                    />
                </DataGrid>
                <CodeEditor
                    comboData = { comboData }
                    rules = { rules }
                    comboDlgClosed = { comboDlgClosed }
                    comboDlgManager = { this.comboDlgManager }
                    setKeyboardEventsListener = { this.setKeyboardEventsListener }
                />
                { this.renderContextMenu() }
            </ErrorBoundry>
        )
    }
}

8  General Category / EasyUI for React / Re: DataGrid Draggable rows on: December 11, 2019, 11:17:32 PM
Thank you! It very much helped to me
This is very informative example.
9  General Category / EasyUI for React / [SOLVED] DataGrid Draggable rows on: December 10, 2019, 10:55:30 AM
Hello!
How I can make draggable rows in Datagrid?
I didn't find like a"renderRow" props in Datagrid.
It is possible?
Thanks
10  General Category / EasyUI for jQuery / Re: combotreegrid editor gives 'idField' instead of 'treeField' to datagrid on: October 10, 2017, 01:19:41 PM
Thank you, that is perfect works
I didn't resolve it by myself
11  General Category / EasyUI for jQuery / Re: two small but important questions about datagrid on: October 09, 2017, 02:59:32 PM
The 'idField' property indicates what field value will be retrieved and updated to the editing row. You can set it to 'name' that equals to the 'treeField' property.

Is There other way to achieve in your example http://code.reloado.com/odiroq3/edit#javascript,html,live that will show 'textField' or 'treeField' property instead of 'idField' after combotreegrid editing in datagrid?

in case {idField: 'name'} don't work dynamicaly loading nodes in combotreegrid, because json became like this {id: 'name'},  what isn't convenient.
12  General Category / EasyUI for jQuery / Re: combotreegrid dynamic loading on: October 05, 2017, 10:37:20 AM
I resolved this issue
i didn't have 'state' field. It is my misstake. I'am sorry

Thank you for your help
13  General Category / EasyUI for jQuery / Re: combotreegrid dynamic loading on: October 01, 2017, 12:27:45 PM

I have learnt this example and this tutorial https://www.jeasyui.com/tutorial/tree/treegrid3.php
but dynamic loading doesn't work in combotreegrid editor in datagrid table.
Can you check it? Thank you
14  General Category / EasyUI for jQuery / [SOLVED] combotreegrid dynamic loading on: September 28, 2017, 12:15:49 PM
Does is work dynamic loading nodes in combotreegrid like this example
https://www.jeasyui.com/tutorial/tree/treegrid3.php ?

In my code built-in 'combotreegrid' editor doesn't send POST with node's id
15  General Category / EasyUI for jQuery / [SOLVED] combotreegrid editor gives 'idField' instead of 'treeField' on: September 19, 2017, 12:19:53 AM
In your example http://code.reloado.com/odiroq3/edit#javascript,html,live
If we change 'product name' then in field we see idField instead of textField of treefield
but then we will delete line  idField: 'id' all works as it is necessary.
Does it true work?
Pages: [1] 2
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!