Telerik Forums
KendoReact Forum
7 answers
1.5K+ views

Hi,

The KendoReact Upload component seems to only cater for sending files to dedicated server handlers. Is there any way to convert attached files to a byte array rather than posting to a server endpoint?

Kind regards,

David

Stefan
Telerik team
 answered on 02 Feb 2021
4 answers
1.4K+ views

i use Springboot for backend and database, front as react.

 

i want to use saveUrl in kendo-upload ui post my image to springboot and saving image in mysql db.

 

i have "uploadFile" variable as axios request parameter

 

 

@RestController
@CrossOrigin
public class MemberController {

@Autowired
MemberMapper mapper;


MultipartFile upload;
String photoname;

 

 

@PostMapping(value = "/member/upload", consumes = {"multipart/form-data"})
public Map<String, String> fileUpload(@RequestParam MultipartFile uploadFile, HttpServletRequest request){
String uploadPath = request.getSession().getServletContext().getRealPath("/WEB-INF/photo");
System.out.println(uploadPath);


int pos = uploadFile.getOriginalFilename().lastIndexOf("."); 
String ext = uploadFile.getOriginalFilename().substring(pos);


Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
photoname = "jeju" + sdf.format(date) + ext;

upload = uploadFile;

Map<String, String> map = new HashMap<String, String>();
map.put("photoname", photoname);
return map;
}

 

 

 

and 

for react

 

let uploadFile = null;

    imageUpload=(e)=>{
        const uploadFile = e.affectedFiles[0].name;
        
        const memberFile = new FormData();
        memberFile.append("uploadFile",uploadFile);
        axios({
            method: 'post',
            url: URL + '/member/upload',
            data: memberFile,
            headers: {'Content-Type':'multipart/form-data'}
        }).then(response=>{
            alert(response.data.photoname+" ==> save as this name");
            
            this.setState({
                photoname: response.data.photoname
            })
        }).catch(err=>{
            console.log("error while uploading images:"+err);
        })
    }

 

 

 onAdd = (event) => {
        const afterStateChange = () => {
            event.affectedFiles
                .filter(file => !file.validationErrors)
                .forEach(file => {
                    const reader = new FileReader();
                    reader.onloadend = (ev) => {
                        this.setState({
                            filePreviews: {
                                ...this.state.filePreviews,
                                [file.uid]: ev.target.result
                            }
                        });
                    };
                    reader.readAsDataURL(file.getRawFile());
                });
        };
        this.setState({
            files: event.newState,
            events: [
                ...this.state.events,
                `selected file: ${event.affectedFiles[0].name}`
            ],
        }, afterStateChange);
        uploadFile = event.affectedFiles[0].name;
    }

 

 

 

render(){

    return (

 <div>
                    <InputLabel id="demo-simple-select-label">picture</InputLabel>
                    <br />
                    <Upload 
                        batch={false}
                        multiple={true}
                        files={this.state.files}
                        onAdd={this.onAdd}
                        onRemove={this.onRemove}
                        onProgress={this.onProgress}
                        onStatusChange={this.onSatusChange}
                        withCredentials={false}
                        saveUrl={URL + '/member/upload'}
                        removeUrl={'https://demos.telerik.com/kendo-ui/service-v4/upload/remove'}
                        onChange={this.imageUpload.bind(this)}
                    />
                    <div className={'example-config'} style={{ marginTop: 20 }}>
                        <ul className={'event-log'}>
                            {
                                this.state.events.map(event => <li key={event}>{event}</li>)
                            }
                        </ul>
                    </div>
                    {
                        this.state.files.length ? 
                        <div className={'img-preview example-config'}>
                            <h3>image preview</h3>
                            {
                                Object.keys(this.state.filePreviews)
                                    .map((fileKey, index) => (<img 
                                        src={this.state.filePreviews[fileKey]} 
                                        alt={index}
                                        style={{ width: 200, margin: 10 }} 
                                    />))
                            }
                        </div> : undefined
                    }
                </div>

);

 

}

Stefan
Telerik team
 answered on 29 Jan 2021
2 answers
2.4K+ views
I have a Boolean column in my grid and I'm using cellRender to change the default true/false to Yes/No. How do I change the text displayed in the dropdown list of filtering options from (all), true, and false to All, Yes, and No?
Steve
Top achievements
Rank 1
 answered on 28 Jan 2021
1 answer
508 views

Hello,

 1) I am trying to put some extra notes while hovering over data points. I am using a Scatter plot. While trying the example given below, it only works for "line" but not scatter. I am also getting data from firebase from a JSON structure. please let me know how the structure should be. Refer screenshot 1.

 <ChartSeriesItem type="line" data={seriesData} field="value" noteTextField="extremum" /> 

 

2) Color for different datapoint, I am trying to mark x and y from firebase. each x,y represents a hand or leg. I want each to be in separate color, How to implement that. again I have attached a JSON structure, refer screenshot 1.

Stefan
Telerik team
 answered on 27 Jan 2021
1 answer
214 views

Hi Team, 

How do I use the min/max button props for windows? Im trying to hide the buttons without success, I've tried these values with the following results:
true/false - failed
"true"/"false" - works, but theres a warning in the browser console. (If it doesnt appear at first, refresh the page)
blank string - failed
the letter 's' - works, no errors (this was an accident, some letters work, some dont. I didnt try them all)

StackBlitz Demo

Thanks,
Grant

Stefan
Telerik team
 answered on 27 Jan 2021
3 answers
374 views

Hi Team, 

As my title says, the KendoReact Loader is not rendering, at least not visually.

I've created https://stackblitz.com/edit/react-2gnzaw to duplicate the issue. From the simple code you will see there is suppose to be a loader constantly visible after the button, but also when you click the button, a loader should appear in the button.

Please advise.

Thanks,
Grant

Grant
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 26 Jan 2021
1 answer
318 views

Hello,

 

We are using kendo-react-inputs 3.17.0

I've created minimal reproduction example from problem that we have with Checkbox component.

If, we at the very first step click on the checkbox then properly true is displayed. Checkbox also says true.

Then, we click button that changes Parent state outside from kendo component. Now, it looks like checkbox is not updated.

Checkbox still says it's true, but we can see that text value says false.

 

Example is here:

https://codesandbox.io/s/serene-jackson-lrc2i?file=/src/Parent.tsx

 

Thanks in advance for explanation!

 

Best regards,

Arek

Silviya
Telerik team
 answered on 26 Jan 2021
1 answer
138 views

1) Use this StackBlitz application: https://react-scwx3i.stackblitz.io - This is based on Telerik's own DatePicker React example.

2) Highlight the AM/PM section.

3) Try to change the AM/PM section via typing. It doesn't change. Note that other fields in the date/time picker are responsive to keyboard input.

Expectation is that the AM/PM section should respect at least "A" and "P" inputs.

Stefan
Telerik team
 answered on 20 Jan 2021
1 answer
667 views

1) Use this StackBlitz application: https://react-scwx3i.stackblitz.io - This is based on Telerik's own DatePicker React example.

2) Highlight the AM/PM section.

3) Press the up arrow key to go from "AM" -> "PM" -> "AM" - note that for each "PM" to "AM" change, the Day value increments

4) Press the down arrow key to go from "AM" -> "PM" -> "AM" - note that for each "AM" to "PM" change, the Day value decrements.

My expectation is that changing AM/PM values should not change any other sections of the Date/Time value.

Stefan
Telerik team
 answered on 20 Jan 2021
2 answers
699 views

I am a beginner with js and react and i try in my environment to recreate a chart.

I have everything I need (package, react, etc) but I can't make it work the example code.

I know that the problem becomes from the last part of code (ReactDOM.render) but i don't know with certainty what is it.

What i doing wrong?

 

 

Alex
Top achievements
Rank 1
 answered on 19 Jan 2021
Narrow your results
Selected tags
Tags
General Discussions
Grid
Wrappers for React
Charts
Scheduler
Filter 
DropDownList
Form
DatePicker
Styling / Themes
Editor
TreeList
Styling
PDF Processing
ComboBox
Excel Export
Dialog
Input
TreeView
Upload
Drawer
Button
Drag and Drop
MultiSelect
Tooltip
Accessibility
NumericTextBox
Checkbox
Menu
Gantt
DateTimePicker
PDF Viewer
Popup
Window
AutoComplete
DateInput
Sortable
Data Query
Licensing
TabStrip
Drawing
Calendar
Pager 
Labels 
Localization
TimePicker
GridLayout
FontIcon
Animation
PanelBar
TaskBoard
PivotGrid
Card
DropDownButton
Conversational UI 
DateRangePicker
Splitter
Badge 
Security
Slider
Spreadsheet
ContextMenu
MultiViewCalendar
Stepper
MultiColumnComboBox
MultiSelectTree
TextBox
AppBar
File Saver
ListView
MaskedTextBox
RadioButton
Switch
TextArea
Toolbar
DropDownTree
TileLayout
Map
Avatar
Date Math
Gauge
RadioGroup
RangeSlider
Rating
Loader
ExpansionPanel
SvgIcon
Typography
ProgressBar
ScrollView
Popover
StockChart
RadialGauge
Server Components
AIPrompt
Page Templates / Building Blocks
AI Coding Assistant
Chat
ColorGradient
ColorPalette
ColorPicker
Notification
Ripple
Skeleton
ButtonGroup
Chip
ChipList
FloatingActionButton
SplitButton
ActionSheet
Barcode
QR Code
FlatColorPicker
Signature
BottomNavigation
BreadCrumb
StackLayout
Timeline
ListBox
ChunkProgressBar
Sparkline
FileManager
ArcGauge
CircularGauge
LinearGauge
ExternalDropZone
OrgChart
Sankey
VS Code Extension
InlineAIPrompt
SpeechToTextButton
Chart Wizard
Agentic UI Generator
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
OTP Input
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?