Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

column support align attr #137

Closed
wants to merge 3 commits into from
Closed

Conversation

henryzp
Copy link

@henryzp henryzp commented Apr 25, 2017

@henryzp
Copy link
Author

henryzp commented Apr 25, 2017

之前列位置只能通过className去自己实现。

那么我的想法是通过参数配置,align。。align加了之后,方式有两种:

1、自己实现class
2、通过style的方式。。

这里为了偷懒,感觉style更方便一些

@benjycui
Copy link
Member

这个算是 feature 了,麻烦提交到 branch feature-2.10

然后需要更新 API 文档并修复CI,谢谢。

const cell = {
key: column.key,
className: column.className || '',
style: styleProp,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

略好奇,column 这里就不能直接设置 style 属性么? @afc163 @yesmeck

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api好像没有提供,不过我觉得如果开放这个api,直接在配置里面这样写:

column: [{
    styleProp: {textAlign: "center"}
}]

也是可以的,但感觉有些麻烦。。

不过开放这个API之后,我上面的写法确实会有问题,所以要么是通过叠加class,即内部规定三个class,让其定位位置吧?

@cutie6
Copy link

cutie6 commented Sep 4, 2017

的确加className就行

 {
        title: '项目详情',
        dataIndex: 'id',
        key: 'detail',
        width: '50px',
        className:'alignCenter',
}

@benjycui
Copy link
Member

benjycui commented Sep 5, 2017

除非没有其他的解决方案,不然不认可特定场景专用的 API。

这种场景可以用 columns[n].className 解决,所以就不新增这个 feature 了。

@benjycui benjycui closed this Sep 5, 2017
@afc163 afc163 reopened this Sep 7, 2017
@afc163
Copy link
Member

afc163 commented Sep 7, 2017

I think it is useful, className is advanced usage, espacially for non front-end developer.

@@ -225,9 +225,11 @@ export default class Table extends React.Component {
rows.push([]);
}
}
const styleProp = column.align ? { textAlign: column.align } : null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null => undefined

ci 挂了。

@afc163 afc163 mentioned this pull request Oct 25, 2017
@yesmeck yesmeck closed this Nov 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants