ui.comments

The Comments widget allows exchanging comments between users. Comments in the list are sorted by date and have user avatars names of the authors. Users can edit or remove all their comments.

The widget can be used separately or as a part of another widget.

Constructor

webix.ui({   
    view:"comments",
    currentUser:2,
    data:[
        {
          id:1, user_id:1, date:"2018-06-10 18:45",
          text:"Let's deal with half of the points in the plan without further delays."
        },
        { id:2, user_id:2, date:"2018-06-10 19:40", text:"Yes, let's do it." }
    ],
    users:[
        { id:1, value:"Corvo Attano", image: "./common/imgs/corvo.jpg" },
        { id:2, value:"Daisy Fitzroy", image: "./common/imgs/daisy.jpg" }
    ]
});

Where to start

Methods
adjust adjusts the component to the size of the parent HTML container
attachEvent attaches the handler to an inner event of the component (allows behavior customizations)
bind binds components
blockEvent temporarily blocks triggering of ALL events of the calling object
callEvent calls an inner event
define redefines a single configuration property (or a hash of properties)
destructor destructs the calling object
detachEvent detaches a handler from an event (which was attached before by the attachEvent method)
disable disables the calling view (makes it dimmed and unclickable)
edit lets users edit a comment
enable enables the calling view that was disabled by the 'disable' method
getChildViews returns child views of the calling component
getFormView returns master form for the input
getMenu returns the view object of a context menu with actions
getNode returns the main HTML container for the calling object
getParentView returns the parent view of the component
getTopParentView returns top parent view
getUsers returns a DataCollections with users
hasEvent checks whether the component has the specified event
hide hides the view
isEnabled checks whether the view is enabled
isVisible checks whether the view is visible
load loads data from an external data source.
mapEvent routes events from one object to another
parse loads data to the component from an inline data source
queryView returns inner element/elements of a widget that correspond(s) to the defined parameters
resize adjusts the view to a new size
setCurrentUser sets the current user from whose name the comments will be sent
show makes the component visible
unbind breaks "bind" link
unblockEvent cancels events blocking that was enabled by the 'blockEvent' command
Events
onAfterAdd fires after a comment has been added
onAfterDelete fires after a comment has been deleted
onAfterEditStart fires after editing of a comment has begun
onAfterLoad fires after data loading is complete
onBeforeAdd fires before a new comment is added
onBeforeDelete fires before a comment is deleted
onBeforeEditStart fires before the user starts editing their comment
onBeforeLoad fires immediately before data loading has started
onBeforeMenuAction fires before a menu option is chosen for a comment
onBindRequest fires when the component is ready to receive data from the master component
onDestruct occurs when component destroyed
onLoadError fires when an error occurs during data loading ( invalid server side response )
Properties
animate defines the configuration of view change animation or disables it
borderless used to hide the component borders
container an HTML container (or its id) where the component should be initialized
css the name of the CSS class that will be applied to the view container or the object with styles
currentUser sets the user who sends the comments in a certain instance of the app
data JavaScript array containing data for the component
datatype the type of loaded data
disabled indicates whether an item is enabled
format defines the format of dates
gravity sets the view gravity (1 by default)
height sets the height of the component
hidden defines whether the view will be hidden initially
id the ID of a widget
listItem defines a custom template for comments
maxHeight sets the maximum height for the view
maxWidth sets the maximum width for the view
minHeight sets the minimal height for the view
minWidth sets the minimal width for the view
mode defines which comments are loaded first (oldest or latest)
moreButton defines the label on the "More comments" button
on allows attaching custom handlers to inner events of the component
padding defines the space between the element borders and content (applies the specified value to all sides).
paddingX sets the right and left padding (applies the specified value to both sides)
paddingY sets the top and bottom padding (applies the specified value to both sides)
readonly enables the read-only mode
sendAction defines the key or a combination of keys that send a comment (Enter or Shift+Enter)
type defines the layout borders
url the URL which the component will use to load data after its initialization
users defines the list of users that can add comments
width sets the width of a widget
Other
$getSize returns the current size of the component
$height the current height of the view
$onLoad default action on data loading
$setSize sets the component size
$skin the method which will be called when skin is defined
$view reference to the top HTML element of the view
$width the current width of the view
config all options from the initial component configuration
name indicates the name of the component (a read-only property)
Back to top